add webpack for browser compatibility
This commit is contained in:
Generated
+5130
-21
File diff suppressed because it is too large
Load Diff
+16
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xrpio",
|
||||
"version": "0.1.6",
|
||||
"version": "0.1.7",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://gitea.nitowa.xyz/npm-packages/xrpio.git"
|
||||
@@ -12,17 +12,22 @@
|
||||
"homepage": "https://gitea.nitowa.xyz/docs/xrpio",
|
||||
"description": "XRP arbitrary data writer and reader",
|
||||
"main": "lib/src/index.js",
|
||||
"files": [
|
||||
"lib/src",
|
||||
"lib/browser"
|
||||
],
|
||||
"scripts": {
|
||||
"clean": "rm -rf gui/main.js gui/index.html gateway/main.js build lib docs",
|
||||
"start": "npm run build && npm run launch",
|
||||
"launch": "node ./lib/Launcher.js",
|
||||
"tsc": "tsc",
|
||||
"build": "npm run clean && tsc",
|
||||
"build": "npm run clean && tsc && npm run webpack",
|
||||
"build-all": "npm run build && npm run webpack-gui",
|
||||
"webpack-gui": "webpack --config webpack.gui.js --progress && cp build/gui/main.js gui",
|
||||
"webpack-gateway": "webpack --config webpack.gateway.js --progress && cp build/gateway/main.js gateway",
|
||||
"test": "npm run build && mocha --bail=true ./lib/test/*.js",
|
||||
"deploy": "node ./lib/Deploy.js",
|
||||
"webpack": "webpack --config ./src/webpack.js",
|
||||
"docs": "typedoc --out docs --readme ./README.md --plugin typedoc-plugin-markdown --hideBreadcrumbs ./src/index.ts"
|
||||
},
|
||||
"author": "nitowa",
|
||||
@@ -37,16 +42,25 @@
|
||||
"@types/node": "^14.14.37",
|
||||
"base-64": "^1.0.0",
|
||||
"browserify-zlib": "^0.2.0",
|
||||
"buffer": "^6.0.3",
|
||||
"chai": "^4.3.4",
|
||||
"crypto-browserify": "^3.12.0",
|
||||
"https-browserify": "^1.0.0",
|
||||
"mocha": "^9.2.0",
|
||||
"net": "^1.0.2",
|
||||
"node-fetch": "^2.6.2",
|
||||
"process": "^0.11.10",
|
||||
"stream-browserify": "^3.0.0",
|
||||
"stream-http": "^3.2.0",
|
||||
"tls": "^0.0.1",
|
||||
"ts-loader": "^8.1.0",
|
||||
"typedoc": "^0.22.11",
|
||||
"typedoc-plugin-markdown": "^3.11.12",
|
||||
"typescript": "^4.5.0",
|
||||
"url": "^0.11.0",
|
||||
"utf8": "^3.0.0",
|
||||
"webpack": "^5.75.0",
|
||||
"webpack-cli": "^5.0.0",
|
||||
"wtfnode": "^0.9.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
const path = require('path');
|
||||
const webpack = require('webpack');
|
||||
|
||||
module.exports = {
|
||||
mode: "production",
|
||||
target: "web",
|
||||
entry: path.resolve(__dirname, 'index.ts'),
|
||||
output: {
|
||||
path: path.resolve(__dirname, '..', 'lib', 'browser'),
|
||||
filename: "xrpio.browser.js",
|
||||
libraryTarget: "window"
|
||||
},
|
||||
resolve: {
|
||||
extensions: [".ts", ".tsx", ".js"],
|
||||
fallback: {
|
||||
"https": require.resolve("https-browserify"),
|
||||
"zlib": require.resolve("browserify-zlib"),
|
||||
"stream": require.resolve("stream-browserify"),
|
||||
"crypto": require.resolve("crypto-browserify"),
|
||||
"http": require.resolve("stream-http"),
|
||||
"https": require.resolve("https-browserify")
|
||||
}
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.ts?$/,
|
||||
loader: "ts-loader"
|
||||
},
|
||||
]
|
||||
},
|
||||
optimization: {
|
||||
minimize: false
|
||||
},
|
||||
externals: {
|
||||
},
|
||||
plugins: [
|
||||
new webpack.ProvidePlugin({
|
||||
process: 'process/browser',
|
||||
Buffer: ['buffer', 'Buffer']
|
||||
})
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user