This repository has been archived by the owner on May 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.config.js
118 lines (101 loc) · 2.58 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
try {
var path = require('path');
var os = require('os');
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var ProgressBarPlugin = require('progress-bar-webpack-plugin');
var autoprefixer = require('autoprefixer');
var precss = require('precss');
} catch (e) {
throw new Error('Missing Webpack Build Dependencies.');
}
module.exports = {
devtool: 'eval-source-map',
context: __dirname,
debug: true,
cache: true,
entry: {
'polyfills': './src/polyfills',
'vendor': './src/vendor',
'app': './src/main'
},
output: {
path: path.join(__dirname, 'www'),
filename: '[name].js',
// chunkFilename: '[id].chunk.js'
},
resolve: {
root: [
path.join(__dirname, 'src'),
path.join(__dirname, 'node_modules')
],
extensions: ['', '.ts', '.js', '.json', '.css', '.html', '.styl'],
unsafeCache: true,
},
module: {
loaders: [{
test: /\.ts$/,
loader: 'ts-loader',
include: path.join(__dirname, 'src'),
query: {
presets: [
'babel-preset-es2015',
'babel-preset-stage-2'
],
cacheDirectory: true,
}
}, {
test: /\.html$/,
loader: 'html'
}, {
test: /\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot|ico)$/,
loader: 'file?name=assets/[name].[hash].[ext]'
}, {
test: /\.styl$/,
loader: 'style!css!postcss!stylus',
}, {
test: /\.css$/,
exclude: path.join(__dirname, 'src', 'app'),
loader: ExtractTextPlugin.extract('style', 'css?sourceMap')
}, {
test: /\.css$/,
include: path.join(__dirname, 'src', 'app'),
loader: 'raw!postcss'
}, {
test: /\.json$/,
loader: 'json'
}],
noParse: [/.+zone\.js\/dist\/.+/, /.+angular2\/bundles\/.+/, /angular2-polyfills\.js/]
},
postcss: function() {
return [precss, autoprefixer];
},
ts: {
compilerOptions: {
sourceMap: false,
sourceRoot: './src',
inlineSourceMap: true
}
},
plugins: [
new ExtractTextPlugin('[name].css'),
new webpack.optimize.CommonsChunkPlugin({
name: ['app', 'vendor', 'polyfills']
}),
new HtmlWebpackPlugin({
template: 'src/public/index.html.ejs',
chunksSortMode: 'dependency',
externalCSS: ['components/loader.css'],
externalJS: ['components/loader.js'],
}),
new ProgressBarPlugin()
],
devServer: {
contentBase: './src/public',
colors: true,
inline: true,
host: '0.0.0.0',
stats: 'minimal'
}
};