-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathwebpack.prod.js.dist
48 lines (45 loc) · 1015 Bytes
/
webpack.prod.js.dist
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
var path = require('path');
var webpack = require('webpack');
var CopyWebpackPlugin = require('copy-webpack-plugin');
var fs = require('fs');
const plugins = [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production'),
},
}),
new CopyWebpackPlugin([{ from: './plugins/**', to: './', ignore: ['*.md'] }]),
];
if (!fs.existsSync(path.join(__dirname, 'dist/plugins.js'))) {
plugins.push(
new webpack.DefinePlugin({
PLUGINS: JSON.stringify([]),
})
);
}
module.exports = {
mode: 'production',
devtool: 'cheap-module-source-map',
entry: ['./src/index.js'],
output: {
path: path.join(__dirname, 'dist'),
filename: 'bundle-[hash].js',
publicPath: '/',
},
plugins,
module: {
rules: [
{
test: /\.jsx?$/,
loader: 'babel-loader',
include: path.join(__dirname, 'src'),
},
],
},
resolve: {
extensions: ['.js'],
alias: {
'@plugins$': path.resolve('./plugins'),
},
},
};