This repository was archived by the owner on Dec 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathwebpack.config.ts
82 lines (71 loc) · 2.17 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
import * as ExtractTextPlugin from 'extract-text-webpack-plugin';
import * as HtmlWebpackPlugin from 'html-webpack-plugin';
import * as path from 'path';
import * as webpack from 'webpack';
const { AureliaPlugin } = require('aurelia-webpack-plugin');
let srcDir = path.resolve(__dirname, 'src');
let distDir = path.resolve(__dirname, 'dist');
let exampleDir = path.resolve(__dirname, 'example');
function configure(env: any, args: any): webpack.Configuration {
let config: webpack.Configuration = {
entry: {
example: 'aurelia-bootstrapper'
},
output: {
path: path.resolve(distDir, 'example'),
filename: '[name]-[hash].js',
chunkFilename: '[name]-[chunkhash].js'
},
module: {
rules: [
{
test: /\.ts$/,
use: 'ts-loader'
},
{
test: /\.html$/,
use: 'html-loader'
},
{
test: /\.scss$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [
'css-loader?sourceMap',
'sass-loader?sourceMap'
]
})
}
]
},
resolve: {
extensions: [
'.js',
'.ts'
],
modules: [
'node_modules',
exampleDir
],
alias: {
'aurelia-split-pane': srcDir,
'aurelia-split-pane$': path.resolve(srcDir, 'index.ts')
}
},
plugins: [
new AureliaPlugin(),
new ExtractTextPlugin('[name]-[contenthash].css'),
new HtmlWebpackPlugin({
template: path.resolve(exampleDir, 'index.html')
})
],
devServer: {
stats: 'errors-only'
}
};
if (args.mode === 'development') {
config.devtool = 'inline-source-map';
}
return config;
}
export default configure;