-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
43 lines (41 loc) · 1.14 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
const path = require("path");
const webpack = require("webpack");
module.exports = [
{
entry: {
cosmjs: "./webpack/cosmjs.js", // Entry point for cosmjs
},
output: {
path: path.join(__dirname, "public/js/functions"), // Output folder
filename: "[name].js", // Dynamically generates 'cosmjs.js' and 'protojs.js'
library: "[name]", // Expose the library globally under the same name as entry
libraryTarget: "umd", // Support for CommonJS, AMD, and browser
globalObject: "this", // Ensures compatibility across environments
},
module: {
rules: [
{
test: /\.tsx?$/, // Match TypeScript files
use: "ts-loader", // Use ts-loader to compile TS
exclude: /node_modules/,
},
],
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
fallback: {
buffer: false,
crypto: false,
events: false,
path: false,
stream: false,
string_decoder: false,
},
},
plugins: [
new webpack.ProvidePlugin({
Buffer: ["buffer", "Buffer"], // Provide Buffer globally
}),
],
},
];