2021-12-01 11:53:47 +00:00
|
|
|
"use strict";
|
|
|
|
const path = require("path");
|
|
|
|
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
|
|
|
const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
|
2021-05-29 15:49:45 +00:00
|
|
|
//const WasmPackPlugin = require('@wasm-tool/wasm-pack-plugin');
|
2021-05-05 17:51:59 +00:00
|
|
|
|
|
|
|
module.exports = {
|
2021-11-30 15:27:32 +00:00
|
|
|
//devtool: 'inline-source-map',
|
|
|
|
//mode: 'development',
|
2021-12-01 11:53:47 +00:00
|
|
|
mode: "production",
|
2021-05-25 15:10:57 +00:00
|
|
|
entry: {
|
2021-12-01 11:53:47 +00:00
|
|
|
bundle: "./templates/index.ts",
|
|
|
|
verificationWidget: "./templates/widget/index.ts",
|
2021-12-02 08:54:53 +00:00
|
|
|
bench: "./templates/widget/service-worker.ts",
|
2021-05-25 15:10:57 +00:00
|
|
|
},
|
2021-05-05 17:51:59 +00:00
|
|
|
output: {
|
2021-12-01 11:53:47 +00:00
|
|
|
filename: "[name].js",
|
|
|
|
path: path.resolve(__dirname, "./static/cache/bundle/"),
|
2021-05-05 17:51:59 +00:00
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.tsx?$/,
|
2021-12-01 11:53:47 +00:00
|
|
|
loader: "ts-loader",
|
2021-05-05 17:51:59 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
test: /\.s[ac]ss$/i,
|
|
|
|
use: [
|
|
|
|
MiniCssExtractPlugin.loader,
|
2021-12-01 11:53:47 +00:00
|
|
|
"css-loader",
|
2021-05-05 17:51:59 +00:00
|
|
|
{
|
2021-12-01 11:53:47 +00:00
|
|
|
loader: "sass-loader",
|
2021-05-05 17:51:59 +00:00
|
|
|
options: {
|
2022-05-07 14:12:49 +00:00
|
|
|
implementation: require("sass"),
|
2021-05-05 17:51:59 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
resolve: {
|
2021-12-01 11:53:47 +00:00
|
|
|
extensions: [".ts", ".tsx", ".js"],
|
2021-05-05 17:51:59 +00:00
|
|
|
},
|
|
|
|
|
2021-05-29 15:49:45 +00:00
|
|
|
plugins: [
|
|
|
|
new MiniCssExtractPlugin(),
|
2021-07-06 18:58:32 +00:00
|
|
|
// new WasmPackPlugin({
|
|
|
|
// crateDirectory: __dirname,
|
|
|
|
// outName: "pow.wasm",
|
|
|
|
// }),
|
2021-05-29 15:49:45 +00:00
|
|
|
],
|
2021-05-05 17:51:59 +00:00
|
|
|
optimization: {
|
|
|
|
minimizer: [
|
|
|
|
// For webpack@5 you can use the `...` syntax to extend existing minimizers (i.e. `terser-webpack-plugin`), uncomment the next line
|
2021-12-01 11:53:47 +00:00
|
|
|
"...",
|
2021-05-05 17:51:59 +00:00
|
|
|
new CssMinimizerPlugin(),
|
|
|
|
],
|
|
|
|
},
|
2021-07-06 18:58:32 +00:00
|
|
|
experiments: {
|
|
|
|
// executeModule: true,
|
|
|
|
// outputModule: true,
|
|
|
|
//syncWebAssembly: true,
|
|
|
|
// topLevelAwait: true,
|
|
|
|
asyncWebAssembly: true,
|
|
|
|
// layers: true,
|
|
|
|
// lazyCompilation: true,
|
|
|
|
},
|
2021-05-05 17:51:59 +00:00
|
|
|
};
|