-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.start.js
70 lines (68 loc) · 1.52 KB
/
webpack.start.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
/**
* @fileoverview demo.
*
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @version 0.1.0.0, Jan 4, 2020
*/
const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')
module.exports = {
mode: 'development',
watch: true,
output: {
filename: '[name]',
path: path.resolve(__dirname, 'demo/dist'),
},
entry: {
'index.js': './demo/index.js',
},
resolve: {
extensions: ['.js', '.ts'],
},
module: {
rules: [
{
test: /\.ts$/,
use: 'ts-loader',
},
{
test: /\.js$/,
exclude: '/node_modules/',
use: {
loader: 'babel-loader',
options: {
presets: [
[
'@babel/env',
{
targets: {
browsers: [
'last 2 Chrome major versions',
'last 2 Firefox major versions',
'last 2 Safari major versions',
'last 2 Edge major versions',
'last 2 iOS major versions',
'last 2 ChromeAndroid major versions',
],
},
},
],
],
},
},
},
],
},
plugins: [
new HtmlWebpackPlugin({
chunks: ['index.js'],
filename: './index.html',
template: './demo/index.html',
}),
],
devServer: {
contentBase: path.join(__dirname, '.'),
port: 9219,
host: '0.0.0.0',
},
}