-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathwebpack.config.js
67 lines (64 loc) · 1.85 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
const webpack = require('webpack');
const path = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
var ProvidePlugin = require('webpack/lib/ProvidePlugin');
const config = {
entry: {
'app': './src/app'
},
output: {
path: path.resolve(__dirname, './target'),
filename: '[name].js'
},
resolve: {
extensions: ['.ts', '.es6', '.js', '.json'],
alias: {
voronoi: path.resolve(__dirname, "./node_modules/voronoi/rhill-voronoi-core.js")
}
},
module: {
loaders: [
{ test: /\.ts$/, exclude: /node_modules/, loader: 'ts-loader' },
{ test: /\.json$/, loader: 'json-loader' },
{ test: /\.css$/, use: [{loader: "style-loader"}, {loader: "css-loader"}] },
{ test: /\.(gif|png|jpe?g)$/i, loader: 'file-loader?name=dist/images/[name].[ext]' },
{ test: /\.woff2?$/, loader: 'url-loader?name=dist/fonts/[name].[ext]&limit=10000&mimetype=application/font-woff' },
{ test: /\.(ttf|eot|svg)$/, loader: 'file-loader?name=dist/fonts/[name].[ext]' },
{ test: /\.txt$/, loader: "raw-loader" }
]
}
};
if (!(process.env.WEBPACK_ENV === 'production')) {
config.devtool = 'source-map';
config.plugins = [
new HtmlWebpackPlugin({
template: './src/index.html',
inject: false
}),
new webpack.DefinePlugin({
'WEBPACK_ENV': '"dev"'
})
]
} else {
config.plugins = [
new HtmlWebpackPlugin({
template: './src/index.html',
inject: false
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
screw_ie8: true,
warnings: false
},
comments: false
}),
new webpack.DefinePlugin({
'WEBPACK_ENV': '"production"'
}),
new CopyWebpackPlugin([
{ from: './src/includes/', to: './includes/'}
], {})
];
}
module.exports = config;