-
Notifications
You must be signed in to change notification settings - Fork 7
/
webpack.config.base.js
170 lines (160 loc) · 3.49 KB
/
webpack.config.base.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
// MODULES //
const { join, resolve } = require( 'path' );
const MonacoWebpackPlugin = require( 'monaco-editor-webpack-plugin' );
// VARIABLES //
/*
* External modules that need not to be bundled with the main electron application. Due to copying a significant chunk of the `node_modules` when bundling as `externalResources` so that users can use these packages, placing a package in this list avoids code duplication.
*/
const EXTERNALS = [
'@stdlib/*',
'archiver',
'child_process',
'compute-chunkify',
'cross-spawn',
'csv-stringify',
'csvtojson',
'd3',
'd3-cloud',
'eslint', // needs to be external for CLI Engine to work for linting
'form-data',
'fsevents',
'markdown-it',
'minimist',
'ml-pca',
'murmurhash3js',
'node-libs-browser',
'pdfjs-dist',
'pressure',
'react-bootstrap',
'react-color',
'react-copy-to-clipboard',
'react-dates',
'react-floater',
'react-grid-layout',
'react-highlight-words',
'react-input-range',
'react-joyride',
'react-json-tree',
'react-live',
'react-plotly.js',
'react-slick',
'react-table',
'react-virtualized',
'recordrtc',
'stemmer',
'svgo',
'typo-js',
'uniq',
'venn.js',
'webpack'
];
// MAIN //
const config = {
module: {
rules: [ {
test: /\.js?$/,
use: [
{
loader: 'esbuild-loader',
options: {
loader: 'jsx',
target: 'es2015',
legalComments: 'none'
}
}
],
include: [
join( __dirname, 'main.development.js' ),
join( __dirname, 'app' ),
join( __dirname, '@isle-project' )
],
exclude: /fonts\.js$/
},
{
test: /\.txt$/,
type: 'asset/source'
},
{
test: /\.css$/,
use: [
'style-loader',
'css-loader'
]
},
{
test: /\.(ico|jpg|jpeg|png|gif|eot|otf|webp|ttf|woff|woff2|ogg)(\?.*)?$/,
type: 'asset/resource'
}],
noParse: [
/node_modules\/json-schema\/lib\/validate\.js/
]
},
output: {
path: join( __dirname, 'dist' ),
filename: 'bundle.js',
libraryTarget: 'commonjs2',
globalObject: '(typeof self !== "undefined" ? self : this)',
assetModuleFilename: 'static/media/[name][ext][query]'
},
resolve: {
alias: {
'victory': resolve( './node_modules/victory/dist/victory.min.js' ),
'form-data': resolve( './node_modules/form-data/lib/form_data.js' ),
'prop-types': resolve( './node_modules/prop-types/prop-types' ),
'react/jsx-dev-runtime.js': resolve( './node_modules', 'react', 'jsx-dev-runtime.js'),
'react/jsx-runtime.js': resolve( './node_modules', 'react', 'jsx-runtime.js')
},
modules: [
resolve( './' ),
resolve( './app' ),
resolve( './node_modules' )
],
extensions: [ '.js', '.json' ],
mainFields: [ 'webpack', 'browser', 'web', 'browserify', [ 'jam', 'main' ], 'main' ]
},
plugins: [
new MonacoWebpackPlugin({
features: [
'accessibilityHelp',
'bracketMatching',
'caretOperations',
'clipboard',
'codeAction',
'codelens',
'colorDetector',
'coreCommands',
'cursorUndo',
'dnd',
'find',
'folding',
'fontZoom',
'gotoError',
'gotoLine',
'hover',
'inPlaceReplace',
'indentation',
'inspectTokens',
'linesOperations',
'links',
'multicursor',
'parameterHints',
'quickCommand',
'referenceSearch',
'rename',
'smartSelect',
'snippets',
'suggest',
'toggleHighContrast',
'toggleTabFocusMode',
'transpose',
'wordHighlighter',
'wordOperations',
'wordPartOperations'
],
languages: [ 'javascript', 'typescript' ]
})
],
externals: EXTERNALS
};
// EXPORTS //
module.exports = config;