-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
67 lines (59 loc) · 1.58 KB
/
webpack.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
const path = require("path");
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const CopyPlugin = require("copy-webpack-plugin");
module.exports = {
// When the mode is set to "production", the JS file is output in an optimized state
// When the mode is set to "development", the source map is valid and the JS file is output
// mode: "production",
// or
mode: "development",
// Launch local development environment, browser automatically opens localhost at runtime
devServer: {
// contentBase: "dist",
strict: "dist",
open: true
},
entry: "./src/index.ts",
plugins: [
new CleanWebpackPlugin(),
new HtmlWebpackPlugin({
title: "Pixi.js Demo", // If there is template.html, that title takes precedence
template: "./src/html/index.html"
}),
new CopyPlugin({
patterns: [
{
from: "src/assets", to: "assets"
}
]
})
],
output: {
filename: "main.js",
path: path.resolve(__dirname, "dist")
},
resolve: {
extensions: [".ts", ".js"]
},
devServer: {
// public folder of webpack-dev-server
// contentBase: path.join(__dirname, "dist")
},
// Set rules to be applied to the module (here we often set the loader)
module: {
rules: [
{
// Apply TypeScript compiler to files ending in .ts
test: /\.ts$/,
loader: "ts-loader",
},
{
// Turn off SourceMap warnings.
test: /\.js$/,
enforce: 'pre',
use: ['source-map-loader'],
},
]
}
};