forked from freeCodeCamp/freeCodeCamp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack-workers.js
53 lines (52 loc) · 1.4 KB
/
webpack-workers.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
const path = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = (env = {}) => {
const __DEV__ = env.production !== true;
return {
mode: __DEV__ ? 'development' : 'production',
entry: {
'frame-runner': './src/client/frame-runner.js',
'sass-compile': './src/client/workers/sass-compile.js',
'test-evaluator': './src/client/workers/test-evaluator.js'
},
devtool: __DEV__ ? 'inline-source-map' : 'source-map',
output: {
publicPath: '/js/',
chunkFilename: '[name].js',
path: path.join(__dirname, './static/js')
},
stats: {
// Display bailout reasons
optimizationBailout: true
},
module: {
rules: [
{
test: /\.jsx?$/,
include: [path.join(__dirname, 'src/client/')],
use: {
loader: 'babel-loader',
options: {
babelrc: false,
presets: [
[
'@babel/preset-env',
{ modules: false, targets: '> 0.25%, not dead' }
]
],
plugins: [
'@babel/plugin-transform-runtime',
'@babel/plugin-syntax-dynamic-import'
]
}
}
}
]
},
plugins: [
new CopyWebpackPlugin([
{ from: 'node_modules/sass.js/dist/sass.sync.js' }
])
]
};
};