forked from mattlewis92/angular-calendar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.ts
83 lines (81 loc) · 2.19 KB
/
webpack.config.ts
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
82
83
import * as path from 'path';
import * as webpack from 'webpack';
import { TsConfigPathsPlugin, CheckerPlugin } from 'awesome-typescript-loader';
import * as StyleLintPlugin from 'stylelint-webpack-plugin';
import * as HtmlWebpackPlugin from 'html-webpack-plugin';
const IS_PROD = process.argv.indexOf('-p') > -1;
export default {
devtool: IS_PROD ? 'source-map' : 'eval',
entry: path.join(__dirname, 'demos', 'entry.ts'),
output: {
filename: IS_PROD ? '[name]-[chunkhash].js' : '[name].js'
},
module: {
rules: [{
enforce: 'pre',
test: /\.ts$/,
loader: 'tslint-loader?emitErrors=false&failOnHint=false',
exclude: /node_modules/
}, {
test: /\.ts$/,
loaders: [{
loader: 'awesome-typescript-loader',
options: {
module: 'es2015'
}
}, {
loader: 'angular2-template-loader'
}],
exclude: /node_modules/
}, {
test: /\.scss$/,
loader: 'style-loader!css-loader!sass-loader'
}, {
test: /(node_modules).+\.css$/,
loader: 'style-loader!css-loader'
}, {
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'url-loader?limit=10000&mimetype=application/font-woff'
}, {
test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'file-loader'
}, {
test: /demos[\/\\].+\.(css|html)$/,
loader: 'raw-loader'
}, {
test: /\.ejs$/,
loader: 'ejs-compiled-loader'
}]
},
resolve: {
extensions: ['.ts', '.js'],
alias: {
'angular-calendar$': path.resolve(__dirname, 'src/index.ts')
}
},
devServer: {
port: 8000,
inline: true,
hot: true,
historyApiFallback: true
},
plugins: [
new CheckerPlugin(),
new TsConfigPathsPlugin(),
...(IS_PROD ? [] : [new webpack.HotModuleReplacementPlugin()]),
new webpack.DefinePlugin({
ENV: JSON.stringify(IS_PROD ? 'production' : 'development')
}),
new StyleLintPlugin({
syntax: 'scss',
context: 'scss'
}),
new webpack.ContextReplacementPlugin(
/angular(\\|\/)core(\\|\/)@angular/,
__dirname + '/src'
),
new HtmlWebpackPlugin({
template: path.join(__dirname, 'demos', 'index.ejs')
})
]
};