-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.dev.config.js
75 lines (73 loc) · 2.02 KB
/
webpack.dev.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
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const HtmlWebpackExcludeAssetsPlugin = require('html-webpack-exclude-assets-plugin');
const TSLintPlugin = require('tslint-webpack-plugin');
const PORT = 8080;
module.exports = {
mode: 'development',
entry: {
index: './src/index.ts',
doc: './documentation/doc.ts',
introduce: './src/introduce.ts'
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'dist')
},
module: {
rules: [{
test: /\.ts?$/,
use: 'ts-loader',
exclude: /node_modules/
}, {
test: /\.scss$/,
use: [
{ loader: "style-loader" },
{ loader: "css-loader" },
{ loader: "sass-loader" }
]
},{
test: /\.svg/,
use: 'svg-url-loader'
}]
},
resolve: {
extensions: ['.ts', '.js'],
alias: {
'vue$': 'vue/dist/vue.esm.js'
}
},
devtool: 'inline-source-map',
devServer: {
contentBase: [
path.join(__dirname, 'dist'),
path.join(__dirname, 'lib'),
path.join(__dirname, 'static')
],
hot: true,
port: PORT
},
plugins: [
new HtmlWebpackPlugin({
template: 'src/index.html',
excludeAssets: [/introduce.js/, /doc.ts/]
}),
new HtmlWebpackPlugin({
filename: 'doc.html',
template: 'documentation/doc.html',
excludeAssets: [/index.js/]
}),
new HtmlWebpackPlugin({
filename: 'introduce.html',
template: 'src/introduce.html',
excludeAssets: [/index.js/],
}),
new HtmlWebpackExcludeAssetsPlugin(),
new webpack.HotModuleReplacementPlugin(),
new TSLintPlugin({
files: ['./src/**/*.ts', './lib/**/*.ts'],
format: 'stylish'
})
]
}