-
Notifications
You must be signed in to change notification settings - Fork 279
/
webpack.config.js
49 lines (46 loc) · 1.17 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
/* Import */
var fs = require('fs');
var path = require('path');
var webpack = require('webpack');
var CopyWebpackPlugin = require('copy-webpack-plugin');
/* Update readme and read license */
var version = require('./package.json').version;
var readme = fs.readFileSync('./README.md', 'utf-8').replace(
/cdn\/(.*)\/neataptic.js/, `cdn/${version}/neataptic.js`
);
fs.writeFileSync('./README.md', readme);
var license = fs.readFileSync('./LICENSE', 'utf-8');
/* Export config */
module.exports = {
context: __dirname,
entry: {
'dist/neataptic': './src/neataptic.js',
[`mkdocs/theme/cdn/${version}/neataptic`]: './src/neataptic.js'
},
resolve: {
modules: [
path.join(__dirname, 'node_modules')
]
},
output: {
path: __dirname,
filename: '[name].js',
library: 'neataptic',
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
}
};