-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
81 lines (78 loc) · 2.21 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
var path = require('path');
const DefinePlugin = require('webpack/lib/DefinePlugin');
/**
* Webpack Constants
*/
const ENV = process.env.ENV || process.env.NODE_ENV || 'development';
const HOST = process.env.HOST || 'localhost';
const PORT = process.env.PORT || 3000;
const METADATA = {
host: HOST,
port: PORT,
ENV: ENV
};
module.exports = {
metadata: METADATA,
entry: [
'./src/polyfills.browser',
'./src/main.browser'
],
output: {
path: path.resolve('www/build/js'),
filename: 'app.bundle.js',
pathinfo: true, // show module paths in the bundle, handy for debugging
publicPath: 'build/js/'
},
module: {
loaders: [
{ test: /\.ts$/, loader: 'ts' },
{ test: /\.scss$/, loader: "style!css!sass" },
{ test: /\.png$/, loader: 'url?limit=100000' },
{
test: /\.woff(2)?(\?v=.+)?$/,
loader: "url?limit=10000&mimetype=application/font-woff&name=[hash].[ext]"
},
// { test: /\.woff(2)?(\?v=.+)?$/, loader: "url?limit=10000&mimetype=application/font-woff" },
{ test: /\.(ttf|eot|svg)(\?v=.+)?$/, loader: 'file' },
{ test: /\.html$/, loader: 'html' },
{ test: /\.json$/, loader: 'json' }
],
noParse: [
/reflect-metadata/,
]
},
resolve: {
// NOTE: this syntax is for webpack2
modules: [
path.join(__dirname, 'www', 'app'),
"node_modules"
],
extensions: ["", ".js", ".ts", ".json"]
},
sassLoader: {
includePaths: [
path.resolve(__dirname, "./node_modules/ionic-angular/"),
path.resolve(__dirname, "./node_modules/ionicons/dist/scss/")
]
},
plugins: [
/**
* Plugin: DefinePlugin
* Description: Define free variables.
* Useful for having development builds with debug logging or adding global constants.
*
* Environment helpers
*
* See: https://webpack.github.io/docs/list-of-plugins.html#defineplugin
*/
// NOTE: when adding more properties, make sure you include them in custom-typings.d.ts
new DefinePlugin({
'ENV': JSON.stringify(METADATA.ENV),
'process.env': {
'ENV': JSON.stringify(METADATA.ENV),
'NODE_ENV': JSON.stringify(METADATA.ENV),
'HMR': METADATA.HMR,
}
})
]
}