From 8a17631780b8cb25d29bc9c9a6b0f7f1d45b447a Mon Sep 17 00:00:00 2001 From: Franck Royer Date: Fri, 17 Jun 2022 10:42:40 +1000 Subject: [PATCH] Re-introduce file used by Karma --- webpack.config.cjs | 50 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 webpack.config.cjs diff --git a/webpack.config.cjs b/webpack.config.cjs new file mode 100644 index 0000000000..62b1cac614 --- /dev/null +++ b/webpack.config.cjs @@ -0,0 +1,50 @@ +const webpack = require("webpack"); +const path = require("path"); + +module.exports = { + mode: "development", + entry: { + "js-waku": "./src/index.ts", + }, + devtool: "inline-source-map", + module: { + rules: [ + { + test: /\.(js|tsx?)$/, + use: "ts-loader", + exclude: /(node_modules)|(node\.spec\.ts)/, + }, + { + test: /node\.spec\.ts$/, + use: "ignore-loader", + }, + ], + }, + plugins: [ + new webpack.ProvidePlugin({ + process: "process/browser.js", + Buffer: ["buffer", "Buffer"], + }), + ], + resolve: { + extensions: [".ts", ".js"], + fallback: { + buffer: require.resolve("buffer/"), + crypto: false, + stream: require.resolve("stream-browserify"), + }, + }, + output: { + filename: "[name].js", + path: path.resolve(__dirname, "build/umd"), + library: "jswaku", + libraryTarget: "umd", + globalObject: "this", + }, + optimization: { + splitChunks: { + name: "vendors", + chunks: "all", + }, + }, +};