-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
47 lines (44 loc) · 1.08 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
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const path = require(`path`);
const srcPath = path.resolve(__dirname, `./resources`);
const distPath = path.resolve(__dirname, `./assets/`);
module.exports = async function(mode = `production`) {
const jsFiles = {
'scss/common.scss': `${srcPath}/scss/common.scss`,
'js/common': `${srcPath}/js/common.js`,
'js/main.map': `${srcPath}/js/main.map.js`,
'js/main.list': `${srcPath}/js/main.list.js`,
'js/route.map': `${srcPath}/js/route.map.js`,
'js/ticket': `${srcPath}/js/ticket.js`
};
return {
mode: mode,
resolve: {
extensions: ['*', '.js', '.jsx']
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: [ 'babel-loader' ]
},
{
test:/\.(s*)css$/,
loaders : ExtractTextPlugin.extract({
fallback : 'style-loader',
use : ['css-loader', 'sass-loader?outputStyle=compact']
}),
}
]
},
plugins: [
new ExtractTextPlugin('./bundle.css')
],
entry: jsFiles,
output: {
path: distPath,
filename: `[name].min.js`
}
};
};