-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.production.js
31 lines (29 loc) · 1.12 KB
/
webpack.config.production.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
import path from 'path';
import config, { isResMatch } from './webpack.config.shared';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import ExtractTextPlugin from 'extract-text-webpack-plugin';
export default {
...config,
output: {
...config.output,
filename: `app.[hash].js`,
},
module: {
...config.module,
loaders: [
...config.module.loaders,
{ test: /\.scss$/, loader: ExtractTextPlugin.extract(`style`, `!css!sass`) },
{ test: el => (!isResMatch(el, `node_modules`) || isResMatch(el, `@react-ui`)) && isResMatch(el, `.css`), loader: ExtractTextPlugin.extract(`style`, `!css?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!postcss`) },
{ test: el => (isResMatch(el, `node_modules`) && !isResMatch(el, `@react-ui`)) && isResMatch(el, `.css`), loader: ExtractTextPlugin.extract(`style`, `!css`) },
],
},
plugins: [
...config.plugins,
new HtmlWebpackPlugin({
template: path.join(__dirname, `src`, process.env.MODULE, `index.production.html`),
}),
new ExtractTextPlugin(`app.[contenthash].css`, {
allChunks: true,
}),
],
};