This repository has been archived by the owner on Apr 19, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.dev.js
73 lines (71 loc) · 2.13 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
require("node-env-file")(__dirname + '/.env');
var path = require("path");
var webpack = require("webpack");
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var CopyWebpackPlugin = require('copy-webpack-plugin');
var HtmlPlugin = require('html-webpack-plugin');
var autoprefixer = require('autoprefixer');
var listening = "http://" + process.env.NODE_HOST + ":" + process.env.NODE_PORT;
module.exports = {
devtool: 'inline-source-map',
entry: [
('webpack-dev-server/client?' + listening),
'webpack/hot/only-dev-server',
'whatwg-fetch',
'./src/sass/index.scss',
'./src/app/index',
],
output: {
path: path.join(__dirname),
filename: 'bundle.js',
publicPath: '/',
},
resolve: {
extensions: ['', '.js', '.jsx'],
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new HtmlPlugin({
template: path.join(__dirname, 'src', 'html', 'index.html')
}),
new ExtractTextPlugin('style.css'),
new webpack.NoErrorsPlugin(),
new CopyWebpackPlugin([
{
context: path.join(__dirname, 'src', 'assets', 'img'),
from: '**/*',
to: path.join(__dirname, 'assets', 'img')
}
], {copyUnmodified: false}
),
],
module: {
loaders: [
{
test: /\.js?/,
exclude: /node_modules/,
loaders: ['babel']
},
{
test: /\.scss$/,
loaders: [
'style?sourceMap',
'css?sourceMap',
'resolve-url',
'sass'
]
},
{
test: /\.css/,
loader: ExtractTextPlugin.extract(
'style!' +
'css'
)
},
{
test: /\.(png|jpg|gif|ttf|eot|svg|woff(2)?)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: "file?limit=10000&name=[name].[ext]?[hash]"
}
],
}
};