generated from sparkbox/design-system-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.common.js
63 lines (61 loc) · 1.57 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
52
53
54
55
56
57
58
59
60
61
62
63
const path = require('path');
const webpack = require('webpack');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const StylishReporter = require('webpack-stylish');
const PRODUCTION = process.env.NODE_ENV === 'production';
module.exports = {
stats: 'minimal',
entry: {
'js/scripts': './src/js/index.js',
'js/design-system-interface': './src/js/design-system-interface.js',
'css/base': './src/scss/base.scss',
'css/design-system-interface': './src/scss/design-system-interface.scss',
},
output: {
filename: '[name].js',
chunkFilename: '[name].js',
path: path.resolve(__dirname, 'dist'),
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader',
},
{
test: /\.scss$/,
use: [
{
loader: MiniCssExtractPlugin.loader,
},
{
loader: 'css-loader',
options: { sourceMap: !PRODUCTION }
},
{
loader: 'postcss-loader',
options: { sourceMap: !PRODUCTION }
},
{
loader: 'sass-loader',
options: {
sourceMap: !PRODUCTION,
sassOptions: {
outputStyle: PRODUCTION ? 'compressed' : 'expanded'
}
}
}
]
},
],
},
plugins: [
new webpack.IgnorePlugin({ resourceRegExp: /jquery$/ }),
new MiniCssExtractPlugin({
filename: '[name].css',
chunkFilename: '[id].css'
}),
new StylishReporter()
],
};