-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.config.dev.js
78 lines (76 loc) · 1.87 KB
/
webpack.config.dev.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
78
/* eslint-disable */
/* global __dirname */
/* generated by unstuck-webpack */
const path = require('path');
const webpack = require('webpack');
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const HtmlWebpackPlugin = require('html-webpack-plugin');
const git = require('git-rev-sync');
const dir_js = path.resolve(__dirname, 'src/app');
const dir_css = path.resolve(__dirname, 'src/css');
const dir_build = path.resolve(__dirname, 'dist');
module.exports = {
entry: {
app : path.resolve(__dirname, 'src/index.js')
},
output: {
path: dir_build,
filename: 'bundle.dev.js',
publicPath: 'http://localhost:8080/'
},
resolve: {
modules: ['node_modules', dir_js],
},
devServer: {
contentBase: dir_build,
inline: true
},
devtool: 'source-map',
stats: {
colors: true,
chunkModules: false
},
plugins: [
new HtmlWebpackPlugin({
template: path.resolve(__dirname, 'src/index.html')
}),
new webpack.DefinePlugin({
VERSION: JSON.stringify(require('./package.json').version + '#' + git.short())
}),
new webpack.NoEmitOnErrorsPlugin()
],
module: {
rules: [
{
loader: 'file-loader?name=assets/[name].[ext]',
test: /\.png($|\?)|\.woff($|\?)|\.woff2($|\?)|\.ttf($|\?)|\.eot($|\?)|\.svg($|\?)/
},
{
loader: 'babel-loader',
test: /\.js($|\?)|\.jsx($|\?)/,
exclude: /node_modules/,
options: {
presets : ['es2015', 'react']
}
},
{
test: /\.less$/,
use: [
'style-loader',
'css-loader',
{
loader: 'postcss-loader',
options: {
plugins: function () {
return [
require('autoprefixer')
];
}
}
},
'less-loader'
]
}
]
}
}