forked from liquidcarrot/carrot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
50 lines (47 loc) · 1.16 KB
/
webpack.config.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
/* Import */
let fs = require('fs');
let path = require('path');
let webpack = require('webpack');
let CopyWebpackPlugin = require('copy-webpack-plugin');
/* Update readme and read license */
let version = require('./package.json').version;
let readme = fs.readFileSync('./README.md', 'utf-8').replace(
/cdn\/(.*)\/carrot.js/, `cdn/${version}/carrot.js`
);
fs.writeFileSync('./README.md', readme);
let license = fs.readFileSync('./LICENSE', 'utf-8');
/* Export config */
module.exports = {
mode: "production",
context: __dirname,
entry: {
'dist/carrot': './src/carrot.js',
[`./theme/static/cdn/${version}/carrot`]: './src/carrot.js'
},
resolve: {
modules: [
path.join(__dirname, 'node_modules')
]
},
output: {
path: __dirname,
filename: '[name].js',
library: 'carrot',
libraryTarget: 'umd'
},
plugins: [
new webpack.NoEmitOnErrorsPlugin(),
new webpack.BannerPlugin(license),
new webpack.optimize.ModuleConcatenationPlugin(),
new CopyWebpackPlugin([
{ from: 'src/multithreading/workers/node/worker.js', to: 'dist' }
])
],
externals: [
'child_process',
'os'
],
node: {
__dirname: false
}
}