mCaptcha/webpack.config.js

70 lines
1.6 KiB
JavaScript
Raw Normal View History

2021-12-01 17:23:47 +05:30
"use strict";
const path = require("path");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
2021-05-29 21:19:45 +05:30
//const WasmPackPlugin = require('@wasm-tool/wasm-pack-plugin');
module.exports = {
//devtool: 'inline-source-map',
//mode: 'development',
2021-12-01 17:23:47 +05:30
mode: "production",
2021-05-25 20:40:57 +05:30
entry: {
2021-12-01 17:23:47 +05:30
bundle: "./templates/index.ts",
verificationWidget: "./templates/widget/index.ts",
bench: "./templates/widget/service-worker.ts",
2021-05-25 20:40:57 +05:30
},
output: {
2021-12-01 17:23:47 +05:30
filename: "[name].js",
path: path.resolve(__dirname, "./static/cache/bundle/"),
},
module: {
rules: [
{
test: /\.tsx?$/,
2021-12-01 17:23:47 +05:30
loader: "ts-loader",
},
{
test: /\.s[ac]ss$/i,
use: [
MiniCssExtractPlugin.loader,
2021-12-01 17:23:47 +05:30
"css-loader",
{
2021-12-01 17:23:47 +05:30
loader: "sass-loader",
options: {
2021-12-01 17:23:47 +05:30
implementation: require("dart-sass"),
},
},
],
},
],
},
resolve: {
2021-12-01 17:23:47 +05:30
extensions: [".ts", ".tsx", ".js"],
},
2021-05-29 21:19:45 +05:30
plugins: [
new MiniCssExtractPlugin(),
// new WasmPackPlugin({
// crateDirectory: __dirname,
// outName: "pow.wasm",
// }),
2021-05-29 21:19:45 +05:30
],
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 17:23:47 +05:30
"...",
new CssMinimizerPlugin(),
],
},
experiments: {
// executeModule: true,
// outputModule: true,
//syncWebAssembly: true,
// topLevelAwait: true,
asyncWebAssembly: true,
// layers: true,
// lazyCompilation: true,
},
};