Webpack / ESM

This commit is contained in:
Aleksandr Kraiz
2022-04-24 01:24:39 +04:00
parent 0804b592d8
commit f4297f2a0d
4 changed files with 3179 additions and 154 deletions

26
webpack.config.js Normal file
View File

@@ -0,0 +1,26 @@
const path = require("path");
module.exports = (env, argv) => {
return {
entry: {
index: path.resolve(__dirname, "./lib/esm/index.js")
},
output: {
path: path.resolve(__dirname, "./lib/umd"), // builds to ./lib/umd/
filename: "[name].js", // index.js
library: "orionprotocol", // aka window.myLibrary
libraryTarget: "umd", // supports commonjs, amd and web browsers
globalObject: "this"
},
module: {
rules: [{ test: /\.t|js$/, use: "babel-loader" }]
},
resolve: {
fallback: {
"crypto": require.resolve("crypto-browserify"),
"buffer": require.resolve("buffer/"),
"stream": require.resolve("stream-browserify"),
}
}
};
};