-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
85 lines (78 loc) · 2.17 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// const path = require('path');
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");
module.exports = {
// モード値を production に設定すると最適化された状態で、
// development に設定するとソースマップ有効でJSファイルが出力される
mode: "production",
// mode: "development",
// ローカル開発用環境を立ち上げる
// 実行時にブラウザが自動的に localhost を開く
devServer: {
// contentBase: "dist", webpack-dev-server ver.3
static: "dist",
open: true
},
// メインとなるJavaScriptファイル(エントリーポイント)
entry: "./src/index.js",
plugins: [
new CleanWebpackPlugin(),
new HtmlWebpackPlugin({
title: "Pixi.js Demo", // If there is template.html, that title takes precedence
template: "./src/index.html"
})
],
// ファイルの出力設定
output: {
// 出力ファイルのディレクトリ名
path: `${__dirname}/dist`,
// path: path.resolve(__dirname, `${__dirname}/dist`),
// 出力ファイル名
filename: "main.js",
},
module: {
rules: [
{
// 拡張子 .js の場合
test: /\.js$/,
use: [
{
// Babel を利用する
loader: "babel-loader",
// Babel のオプションを指定する
options: {
presets: [
// プリセットを指定することで、ES2019 を ES5 に変換
"@babel/preset-env"
]
}
}
]
},
// css
{
test: /\.css/,
use: [
"style-loader",
{
loader: "css-loader",
options: { url: false }
}
]
},
// 画像をBase64エンコード
{
test: /\.(jpg|png|gif)$/,
// loader: "url-loader"
type: "asset/inline",
}
]
},
// performance: { hints: false }
performance: {
maxEntrypointSize: 1000000, // s1Mbyte
maxAssetSize: 1000000, // 1Mbyte
},
// ES5(IE11等)向けの指定
target: ["web", "es5"],
};