-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.babel.js.old
84 lines (80 loc) · 2.6 KB
/
webpack.config.babel.js.old
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import path from 'path';
import webpack from 'webpack';
import ExtractTextPlugin from 'extract-text-webpack-plugin';
import UglifyESPlugin from 'uglifyjs-webpack-plugin';
import AntdScssThemePlugin from 'antd-scss-theme-plugin';
module.exports = {
//webpack folder`s entry js - excluded from jekyll build
entry: [`./webpack/entry.js`],
mode: `development`,
output: {
// Put the generated file in the assets folder for Jekyll
path: path.resolve(__dirname, `assets/javascripts`),
filename: `bundle.js`,
},
devServer: {
contentBase: path.resolve(__dirname, `webpack`),
port: 8081,
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /(node_modules)/,
loader: `babel-loader`,
},
{
test: /\.scss$/,
exclude: `/node_modules/`,
use: [
{
loader: `style-loader`,
},
{
loader: `css-loader`,
options: {
importLoaders: 1,
modules: true,
camelCase: true,
localIdentName: `[local]`,
},
},
AntdScssThemePlugin.themify(`sass-loader`),
],
},
{
test: /\.less$/,
use: [
{ loader: `style-loader` }, // creates style nodes from JS strings
{
loader: `css-loader`,
options: {
importLoaders: 1,
},
}, // translates CSS into CommonJS
AntdScssThemePlugin.themify({ loader: `less-loader`, options: { javascriptEnabled: true } }),
],
},
],
},
devtool: `source-map`,
plugins: [
new ExtractTextPlugin(`styles.css`),
new AntdScssThemePlugin(path.join(__dirname, `theme.scss`)),
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
],
optimization: {
minimizer: [
new UglifyESPlugin({ }),
],
},
};
if (process.env.NODE_ENV === `production`) {
module.exports.devtool = `cheap-source-map`;
mode: `production`,
module.exports.plugins = (module.exports.plugins || []).concat([
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(`production`),
}),
]);
}