-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
60 lines (52 loc) · 1.5 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
var path = require('path');
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var CopyWebpackPlugin = require('copy-webpack-plugin');
var ENV = process.env.ENV = 'development';
var HOST = process.env.HOST || 'localhost';
var PORT = process.env.PORT || 8080;
var metadata = {
host: HOST,
port: PORT,
ENV: ENV
};
/*
* config
*/
module.exports = {
// static data for index.html
metadata: metadata,
// Emit SourceMap to enhance debugging
devtool: 'source-map',
// Switch loaders to debug mode
debug: true,
// Our angular app
entry: {
'polyfills': path.resolve(__dirname, "src/polyfills.ts"),
'app': path.resolve(__dirname, "src/bootstrap.ts")
},
// Config for our build file
output: {
path: path.resolve(__dirname, "dist"),
filename: '[name].bundle.js',
sourcemapFilename: '[name].map'
},
resolve: {
// Add `.ts` and `.tsx` as a resolvable extension.
extensions: ['', '.webpack.js', '.web.js', '.ts', '.tsx', '.js']
},
module: {
loaders: [
// Support for .ts files
{ test: /\.tsx?$/, loader: 'ts-loader', exclude: [ /\.spec\.ts$/ ] },
// support for .html as raw text
{ test: /\.html$/, loader: 'raw-loader', exclude: [ path.resolve(__dirname, "src/index.html") ] }
]
},
plugins: [
// Copy static assets to the build folder
new CopyWebpackPlugin([{ from: 'src/assets', to: 'assets' }]),
// Generate the index.html
new HtmlWebpackPlugin({ template: 'src/index.html' })
]
}