const path = require('path'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const webpack = require('webpack'); const WasmPackPlugin = require("@wasm-tool/wasm-pack-plugin"); module.exports = { entry: './web/src/index.js', module: { rules: [ { test: /\.tsx?$/, use: 'swc-loader', exclude: /node_modules/, }, { test: /\.scss$/i, use: [ // Creates `style` nodes from JS strings "style-loader", // Translates CSS into CommonJS "css-loader", // Compiles Sass to CSS "sass-loader", ], }, ], }, resolve: { extensions: ['.tsx', '.ts', '.js'], }, output: { path: path.resolve(__dirname, 'dist/static'), filename: 'index.js', }, plugins: [ new HtmlWebpackPlugin({ template: path.resolve(__dirname, 'web/src/index.html'), publicPath: "/static", }), new WasmPackPlugin({ crateDirectory: path.resolve(__dirname, "web"), outDir: path.resolve(__dirname, "web/pkg"), }), ], experiments: { asyncWebAssembly: true, }, mode: 'development' };