forked from daostack/alchemy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.dev.config.js
77 lines (67 loc) · 2.03 KB
/
webpack.dev.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
71
72
73
74
75
76
77
const path = require('path');
const webpack = require('webpack');
const merge = require('webpack-merge');
const baseConfig = require('./webpack.base.config.js');
module.exports = merge(baseConfig, {
devtool: 'cheap-module-eval-source-map',
devServer: {
contentBase: path.resolve(__dirname, 'src'),
hot: true,
publicPath: '/',
historyApiFallback: true,
port: 3000
},
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: [
{ // creates style nodes from JS strings
loader: "style-loader"
},
{ // translates CSS into CommonJS (css-loader) and automatically generates TypeScript types
loader: 'typings-for-css-modules-loader',
options: {
camelCase: true,
modules: true,
namedExport: true,
localIdentName: '[name]__[local]___[hash:base64:5]',
importLoaders: 2,
sourceMap: true
}
},
{ // compiles Sass to CSS
loader: "sass-loader",
options: {
sourceMap: true
}
},
{ // Load global scss files in every other scss file without an @import needed
loader: 'sass-resources-loader',
options: {
resources: ['./src/assets/styles/global-variables.scss']
},
},
]
}
],
},
plugins: [
// enable HMR globally
new webpack.HotModuleReplacementPlugin(),
// Prints more readable module names in the browser console on HMR updates
new webpack.NamedModulesPlugin()
]
});