forked from GoogleChromeLabs/sample-pie-shop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.common.js
51 lines (49 loc) · 1.25 KB
/
webpack.common.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
51
const path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const BROWSERS = [
'last 2 chrome versions',
'last 2 safari versions',
'last 2 firefox versions',
'last 2 edge versions',
];
module.exports = {
entry: {
'app_main.js': './src/client/js/app-main.js',
'home_main.js': './src/client/js/home-main.js',
'category_main.js': './src/client/js/category-main.js',
'product_main.js': './src/client/js/product-main.js',
'cart_main.js': './src/client/js/cart-main.js',
'search_main.js': './src/client/js/search-main.js',
},
module: {
rules: [{
test: /\.js$/,
use: {
loader: 'babel-loader',
options: {
presets: [
['env', {
targets: {
browsers: BROWSERS,
},
modules: false,
}],
],
plugins: ['syntax-dynamic-import'],
babelrc: false,
},
},
}, {
test: /\.css$/,
use: ExtractTextPlugin.extract({use: 'css-loader'}),
}],
},
output: {
filename: 'js/[name]',
chunkFilename: 'js/chunk-[name]',
path: path.resolve(__dirname, 'dist/static'),
},
plugins: [
new ExtractTextPlugin('styles/style.css'),
],
};