-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
37 lines (37 loc) · 1.02 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
const path = require('path');
const webpack = require('webpack');
let basePath = '/';
module.exports = env => {
if ( env.NODE_ENV != 'dev' ) { basePath = '/g/'; console.log(`Env is not dev. building with basepath ${basePath}`); }
return {
entry: [path.join(__dirname, 'node_modules/babel-polyfill'), path.join(__dirname, 'src/js/main.js')],
mode: env.NODE_ENV === 'production' ? 'production' : 'development',
output: {
path: path.resolve(__dirname, 'public/js'),
filename: 'main.js',
},
module: {
rules: [{
test: /\.js$/,
exclude: /node_modules/,
use: 'babel-loader'
},
{
test:/\.css$/,
use:['style-loader','css-loader']
}
]
},
plugins: [
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
Popper: ['popper.js', 'default']
}),
new webpack.DefinePlugin({
BASEPATH : JSON.stringify(basePath),
NODE_ENV : JSON.stringify(env.NODE_ENV),
})
]
}
}