-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
77 lines (75 loc) · 1.95 KB
/
webpack.config.js
File metadata and controls
77 lines (75 loc) · 1.95 KB
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
const path = require('path');
const webpack = require('webpack');
const IS_PROD = process.argv.indexOf('-p') > -1;
const LoaderOptionsPlugin = require("webpack/lib/LoaderOptionsPlugin");
const TsConfigPathsPlugin = require('awesome-typescript-loader').TsConfigPathsPlugin;
module.exports = {
devtool: IS_PROD ? 'source-map' : 'eval',
entry: './demo/entry.ts',
output: {
filename: 'demo.js',
path: IS_PROD ? './demo' : '/'
},
module: {
rules: [
{
test: /\.ts$/,
enforce: 'pre',
loader: 'tslint-loader',
exclude: /node_modules/
},
{
test: /\.ts$/,
loaders: ['awesome-typescript-loader', 'angular2-template-loader?keepUrl=true'],
exclude: [/\.(spec|e2e)\.ts$/, /node_modules/]
},
/* Embed files. */
{
test: /\.(html|css)$/,
loader: 'raw-loader',
exclude: /\.async\.(html|css)$/
},
/* Async loading. */
{
test: /\.async\.(html|css)$/,
loaders: ['file?name=[name].[hash].[ext]', 'extract']
}
]
},
resolve: {
extensions: ['.ts', '.js'],
alias: {
'angular-stormpath-ionic$': path.resolve(__dirname, 'src/index.ts')
}
},
devServer: {
port: 8000,
inline: true,
hot: true,
historyApiFallback: true,
contentBase: 'demo'
},
plugins: [
new TsConfigPathsPlugin(),
new webpack.ContextReplacementPlugin(
// The (\\|\/) piece accounts for path separators in *nix and Windows
/angular(\\|\/)core(\\|\/)(esm(\\|\/)src|src)(\\|\/)linker/,
root('./src') // location of your src
),
new webpack.DefinePlugin({
ENV: JSON.stringify(IS_PROD ? 'production' : 'development')
}),
new webpack.HotModuleReplacementPlugin(),
new LoaderOptionsPlugin({
options: {
tslint: {
emitErrors: false,
failOnHint: false
}
}
})
]
};
function root(__path) {
return path.join(__dirname, __path);
}