-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathwebpack.config.js
54 lines (52 loc) · 1.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
var path = require('path');
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var CopyWebpackPlugin = require('copy-webpack-plugin');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
entry: {
'app': './src/main.ts',
'polyfills': [
'core-js/es6',
'core-js/es7/reflect',
'zone.js/dist/zone'
]
},
output: {
path: './target',
filename: '[name].bundle.js'
},
module: {
loaders: [
{test: /\.component.ts$/, loader: 'ts!angular2-template'},
{test: /\.ts$/, exclude: /\.component.ts$/, loader: 'ts'},
{test: /\.html$/, loader: 'raw'},
{test: /\.css$/, include: path.resolve('src/resources/vendor'), loader: 'raw'},
{test: /\.css$/, include: path.resolve('src/resources/vendor'), loader: ExtractTextPlugin.extract('style', 'css')},
{test: /\.css$/, include: path.resolve('node_modules'), loader: ExtractTextPlugin.extract('style', 'css')},
{test: /\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot|ico)$/, loader: 'file?name=fonts/[name].[ext]'}
]
},
resolve: {
extensions: ['', '.js', '.ts', '.html', '.css']
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({
name: 'polyfills'
}),
new HtmlWebpackPlugin({
template: './src/index.html'
}),
new webpack.DefinePlugin({
app: {
environment: JSON.stringify(process.env.APP_ENVIRONMENT || 'development')
}
}),
new ExtractTextPlugin('[name].css'),
new webpack.ProvidePlugin({
$: 'jquery',
jquery: 'jquery',
jQuery: 'jquery'
})
]
};