forked from daostack/alchemy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.prod.config.js
70 lines (60 loc) · 1.66 KB
/
webpack.prod.config.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
64
65
66
67
68
69
70
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const merge = require('webpack-merge');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const webpack = require('webpack');
const baseConfig = require('./webpack.base.config.js');
const extractSass = new ExtractTextPlugin({
filename: "[name].[contenthash].css"
});
module.exports = merge(baseConfig, {
devtool: 'source-map',
entry: [
// activate HMR for React
'react-hot-loader/patch',
// bundle the client for webpack-dev-server
// and connect to the provided endpoint
'webpack-dev-server/client?http://localhost:3000',
// bundle the client for hot reloading
// only- means to only hot reload for successful updates
'webpack/hot/only-dev-server',
// the entry point of our app
__dirname + '/src/index.tsx',
],
module: {
rules: [
{
test: /\.scss$/,
use: extractSass.extract({
use: [
{
loader: "css-loader",
options: {
minimize: true,
modules: true, // Use CSS Modules
localIdentName: '[name]__[local]___[hash:base64:5]',
importLoaders: 2
}
},
{
loader: "sass-loader"
},
{
loader: 'sass-resources-loader',
options: {
resources: ['./src/assets/styles/global-variables.scss']
},
},
],
}),
},
],
},
plugins: [
extractSass,
// Minify JS
// new UglifyJsPlugin({
// sourceMap: false,
// compress: true,
// }),
],
});