-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdev.config.js
More file actions
80 lines (78 loc) · 1.85 KB
/
Copy pathdev.config.js
File metadata and controls
80 lines (78 loc) · 1.85 KB
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
var path = require('path')
var webpack = require('webpack')
const ROOT = '../..'
const PORT = require(ROOT + '/config/serverConfig.json').PORT
var configVars = {
NODE_ENV: JSON.stringify('development'),
BROWSER: JSON.stringify(true)
}
module.exports = {
devtool: 'source-map',
context: path.resolve(__dirname, ROOT),
entry: [
'babel-polyfill',
'webpack-hot-middleware/client',
'react-hot-loader/patch',
'./src/client'
],
output: {
path: path.join(__dirname, ROOT + '/build'),
filename: 'js/main.bundle.js',
publicPath: `http://localhost:${PORT}/`
},
resolve: {
alias: {
Src: path.join(__dirname, ROOT + '/src'),
Config: path.join(__dirname, ROOT + '/config'),
},
extensions: ['.js', '.jsx']
},
plugins: [
new webpack.LoaderOptionsPlugin({
debug: true,
options: {
postcss: [
require('postcss-cssnext'),
require('lost'),
require('postcss-assets')({
baseUrl: `http://localhost:${PORT}/`,
relative: true,
loadPaths: ['static/']
})
]
}
}),
new webpack.DefinePlugin({
'process.env': configVars
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin()
],
module: {
rules: [
{
test: /\.js$/,
use: [
{
loader: 'babel-loader',
options: Object.assign({ babelrc: false }, require('./dev.babelrc.js'))
},
'eslint-loader'
],
exclude: /node_modules/,
},
{
test: /\.scss$/,
use: ['style-loader', 'css-loader?sourceMap', 'postcss-loader', 'sass-loader?sourceMap']
},
{
test: /\.(png|jpg)$/,
loader: 'url-loader?limit=10000'
},
{
test: /\.woff2?$/,
loader: 'url-loader'
},
]
},
}