52 lines
961 B
JavaScript
52 lines
961 B
JavaScript
const path = require("path");
|
|
const CopyPlugin = require("copy-webpack-plugin");
|
|
const WasmPackPlugin = require("@wasm-tool/wasm-pack-plugin");
|
|
|
|
const dist = path.resolve(__dirname, "dist");
|
|
|
|
module.exports = {
|
|
mode: "development",
|
|
entry: {
|
|
index: "./js/index.js"
|
|
},
|
|
devtool: 'inline-source-map',
|
|
output: {
|
|
path: dist,
|
|
filename: "[name].js"
|
|
},
|
|
devServer: {
|
|
static: {
|
|
directory: dist,
|
|
},
|
|
proxy: {
|
|
'/api': {
|
|
target: 'http://localhost:8081',
|
|
pathRewrite: { '^/api': '' }
|
|
}
|
|
},
|
|
watchFiles: ['src/**', 'js/**'],
|
|
},
|
|
plugins: [
|
|
new CopyPlugin({
|
|
patterns: [
|
|
path.resolve(__dirname, "static")
|
|
]
|
|
}),
|
|
new WasmPackPlugin({
|
|
crateDirectory: __dirname,
|
|
}),
|
|
],
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.tsx?$/,
|
|
use: 'ts-loader',
|
|
exclude: /node_modules/,
|
|
}
|
|
]
|
|
},
|
|
experiments: {
|
|
asyncWebAssembly: true,
|
|
},
|
|
};
|