-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
66 lines (65 loc) · 1.95 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
const path = require("path");
const {CleanWebpackPlugin} = require('clean-webpack-plugin');
const HtmlWebpackPlugin = require("html-webpack-plugin");
const WasmPackPlugin = require("@wasm-tool/wasm-pack-plugin");
const createStyledComponentsTransformer = require('typescript-styled-components-plugin').default;
module.exports = {
resolve: {
extensions: [".ts", ".tsx", ".js", ".jsx", ".wasm"]
},
mode: process.env.WEBPACK_ENV,
output: {
// 出力ファイルのディレクトリ名
path: `${__dirname}/dist`,
// 出力ファイル名
filename: "index.js"
},
module: {
rules: [
{
test: /\.tsx?$/,
use: [{
loader: "ts-loader",
options: {
getCustomTransformers: (program) => ({
before: [
createStyledComponentsTransformer(program, {
setComponentId: true,
setDisplayName: true,
minify: true,
}),
],
}),
},
}],
},
{
test: /\.ts?$/,
use: [{
loader: "ts-loader",
}],
},
{
test: /\.wasm$/,
type: "webassembly/async"
}
]
},
watchOptions: {
ignored: /node_modules/,
aggregateTimeout: 300,
poll: 500
},
experiments: {
asyncWebAssembly: true,
},
plugins: [
new CleanWebpackPlugin(),
new HtmlWebpackPlugin({
template: path.join(__dirname, "src/index.html")
}),
new WasmPackPlugin({
crateDirectory: path.join(__dirname, "wasm_component")
})
]
};