mCaptcha/webpack.config.js

70 lines
1.6 KiB
JavaScript
Raw Normal View History

'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');
module.exports = {
//devtool: 'inline-source-map',
//mode: 'development',
mode: 'production',
2021-05-25 15:10:57 +00:00
entry: {
2021-05-29 15:49:45 +00:00
bundle: './templates/index.ts',
2021-05-25 15:10:57 +00:00
mobile: './templates/mobile.ts',
verificationWidget: './templates/widget/js/index.ts',
2021-05-25 15:10:57 +00:00
},
output: {
2021-05-25 15:10:57 +00:00
filename: '[name].js',
2021-05-29 06:52:31 +00:00
path: path.resolve(__dirname, './static/cache/bundle/'),
},
module: {
rules: [
{
test: /\.tsx?$/,
loader: 'ts-loader',
},
{
test: /\.s[ac]ss$/i,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
{
loader: 'sass-loader',
options: {
implementation: require('dart-sass'),
},
},
],
},
],
},
resolve: {
extensions: ['.ts', '.tsx', '.js'],
},
2021-05-29 15:49:45 +00:00
plugins: [
new MiniCssExtractPlugin(),
// new WasmPackPlugin({
// crateDirectory: __dirname,
// outName: "pow.wasm",
// }),
2021-05-29 15:49:45 +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
`...`,
new CssMinimizerPlugin(),
],
},
experiments: {
// executeModule: true,
// outputModule: true,
//syncWebAssembly: true,
// topLevelAwait: true,
asyncWebAssembly: true,
// layers: true,
// lazyCompilation: true,
},
};