-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
50 lines (49 loc) · 1.43 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
"use strict";
const mode = "production";
const TerserPlugin = require("terser-webpack-plugin");
const enabledSourceMap = mode === "production";
const path = require("path");
module.exports = {
// モード値を production に設定すると最適化された状態で、
// development に設定するとソースマップ有効でJSファイルが出力される
mode: mode,
devtool:"source-map",
optimization:{
minimize: enabledSourceMap,
minimizer:[
new TerserPlugin({
extractComments: "all",
terserOptions:{
compress:{
drop_console:true,//production modeでconsole.log消えます
}
}
}),
],
},
target:"nwjs",
// メインとなるJavaScriptファイル(エントリーポイント)
entry: "./src/main.tsx",
// ファイルの出力設定
output: {
// 出力ファイルのディレクトリ名
path: `${__dirname}/dist`,
// 出力ファイル名
filename: "main.min.js"
},
context:path.join(__dirname,"src"),
entry:{main:"./main"},
module: {
rules:[
{
test:/\.tsx?$/,
use:"babel-loader",
exclude:/node_modules/
}
],
},
// import 文で .ts や .tsx ファイルを解決するため
resolve: {
extensions: [".ts", ".tsx", ".js", ".jsx",".json"],
}
}