-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.config.js
More file actions
65 lines (61 loc) · 2.09 KB
/
Copy pathwebpack.config.js
File metadata and controls
65 lines (61 loc) · 2.09 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
const path = require("path");
const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = {
entry: './src/app.ts',
output: {
filename: 'app.js',
path: path.resolve(__dirname, 'dist'),
publicPath: './assets/'
},
resolve: {
extensions: [".ts", '.js', '.html']
},
devtool: 'source-map',
devServer: {
// Can be omitted unless you are using 'docker'
host: '0.0.0.0',
// This is where webpack-dev-server serves your bundle
// which is created in memory.
// To use the in-memory bundle,
// your <script> 'src' should point to the bundle
// prefixed with the 'publicPath', e.g.:
// <script src='http://localhost:9001/assets/bundle.js'>
// </script>
publicPath: '/dist/',
// The local filesystem directory where static html files
// should be placed.
// Put your main static html page containing the <script> tag
// here to enjoy 'live-reloading'
// E.g., if 'contentBase' is '../views', you can
// put 'index.html' in '../views/main/index.html', and
// it will be available at the url:
// https://localhost:9001/main/index.html
contentBase: __dirname,
// 'Live-reloading' happens when you make changes to code
// dependency pointed to by 'entry' parameter explained earlier.
// To make live-reloading happen even when changes are made
// to the static html pages in 'contentBase', add
// 'watchContentBase'
watchContentBase: true,
port: 9001
},
mode: "development",
module: {
rules: [{
test: /\.tsx?$/,
loader: 'ts-loader',
exclude: /node_modules/
},
{
test: /\.html$/,
loader: 'file-loader',
include: path.resolve(__dirname, 'src', 'res', 'html'),
exclude: /node_modules/,
}]
},
plugins : [
new CopyWebpackPlugin([
{ from: 'assets', to: 'assets' },
{ from: './*.html' }
])]
};