-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.react4xp.js
61 lines (55 loc) · 2.1 KB
/
webpack.config.react4xp.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
//──────────────────────────────────────────────────────────────────────────────
// Use this file to adjust the webpack config.
//──────────────────────────────────────────────────────────────────────────────
// A template version of this, with upated properties and explanations,
// can always be found in the react4xp NPM package:
// node_modules/react4xp/examples/webpack.config.react4xp.js after installing,
// or:
// https://github.com/enonic/enonic-react4xp/blob/master/examples/webpack.config.react4xp.js
//──────────────────────────────────────────────────────────────────────────────
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
module.exports = function(env, config) {
// Comment in and customize the lines below to improve incremental builds in
// development mode. (see https://webpack.js.org/configuration/cache/)
//
// if (process.env.NODE_ENV === 'development') {
// config.cache = {
// type: 'filesystem'
// }
// }
// This makes 'npm link' symlinks in node_modules work:
config.resolve.symlinks = true;
config.module.rules = [
...(config.module.rules || []),
{
test: /\.((sa|sc|c))ss$/i,
use: [
MiniCssExtractPlugin.loader,
{
loader: 'css-loader',
options: {
importLoaders: 1,
modules: { auto: true }
}
},
{
loader: 'sass-loader',
options: {
sassOptions: {
outputStyle: 'compressed'
}
}
}
]
}
]
// Set up how the compiled assets are exported:
config.plugins = [
...(config.plugins || []),
new MiniCssExtractPlugin({
filename: '[name].css',
chunkFilename: '[id].[contenthash:9].css'
})
]
return config;
};