-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathwebpack.config.js
83 lines (81 loc) · 2.12 KB
/
webpack.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
78
79
80
81
82
83
const webpack = require('webpack')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const HtmlWebPackPlugin = require('html-webpack-plugin')
const dotEnv = require('dotenv-webpack')
const path = require('path')
module.exports = {
entry: {
app: './app/app.js',
vendor: './app/vendor.js'
},
output: {
filename: '[name].bundle.js',
path: path.join(__dirname, 'dist')
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({
names: ['vendor']
}),
new HtmlWebPackPlugin({
template: 'index.html'
}),
new ExtractTextPlugin({
filename: 'bundle.css',
disable: false,
allChunks: true
}),
new dotEnv({
path: './.env',
systemvars: true
})
],
module: {
rules: [{
test: /\.html$/,
include: path.resolve(__dirname, 'app/'),
loader: `ngtemplate-loader?relativeTo=${__dirname}/app/!html-loader`
}, {
test: /index.html$/,
exclude: path.resolve(__dirname, 'node_modules/'),
use: 'html-loader?name=[name].[ext]'
}, {
test: /\.js$/,
use: 'babel-loader',
exclude: /node_modules/
}, {
test: /\.styl$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: ['css-loader?sourceMap', 'postcss-loader?sourceMap', 'stylus-loader?sourceMap'],
publicPath: '/dist'
})
}, {
test: /\.css$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: ['css-loader', 'postcss-loader?sourceMap'],
publicPath: '/dist'
})
}, {
test: /\.(png|jpeg|jpg|gif)$/,
include: path.join(__dirname, 'app/images/'),
use: 'file-loader?name=images/[name].[ext]&context=app/images/'
}, {
test: /\.(woff|woff2|svg|eot|ttf)(\?.+)?$/i,
use: 'file-loader?name=[name].[ext]'
}]
},
devServer: {
contentBase: path.join(__dirname, 'dist'),
port: 9000,
inline: true,
compress: true,
stats: { colors: true },
clientLogLevel: 'info'
},
watchOptions: {
aggregateTimeout: 300,
ignored: path.resolve(__dirname, 'node_modules/')
},
devtool: 'source-map'
}