Kaynağa Gözat

added webpack and browserified version

master
nitowa 1 yıl önce
ebeveyn
işleme
dc322788c7
3 değiştirilmiş dosya ile 3270 ekleme ve 62 silme
  1. 3208
    59
      package-lock.json
  2. 16
    3
      package.json
  3. 46
    0
      webpack.js

+ 3208
- 59
package-lock.json
Dosya farkı çok büyük olduğundan ihmal edildi
Dosyayı Görüntüle


+ 16
- 3
package.json Dosyayı Görüntüle

@@ -1,6 +1,6 @@
1 1
 {
2 2
   "name": "rjsvm",
3
-  "version": "0.2.2",
3
+  "version": "0.2.4",
4 4
   "description": "",
5 5
   "main": "lib/src/main.js",
6 6
   "scripts": {
@@ -9,11 +9,14 @@
9 9
     "build": "npm run clean && npm run tsc",
10 10
     "launch": "node lib/launcher.js",
11 11
     "test": "npm run clean && npm run build && mocha --bail=true lib/test/Test.js",
12
-    "tsc": "tsc"
12
+    "tsc": "tsc",
13
+    "webpack": "webpack --config ./webpack.js"
13 14
   },
14 15
   "author": "",
15 16
   "license": "ISC",
16 17
   "dependencies": {
18
+    "stream-http": "^3.2.0",
19
+    "url": "^0.11.3",
17 20
     "xrpio": "^0.2.1",
18 21
     "xrpl": "^2.7.0",
19 22
     "zod": "^3.21.4"
@@ -23,11 +26,21 @@
23 26
     "@types/expect": "^1.20.4",
24 27
     "@types/mocha": "^5.2.7",
25 28
     "@types/node": "^18.11.9",
29
+    "browserify-zlib": "^0.2.0",
30
+    "buffer": "^6.0.3",
26 31
     "chai": "^4.3.4",
27 32
     "chai-as-promised": "^7.1.1",
33
+    "crypto-browserify": "^3.12.0",
34
+    "https-browserify": "^1.0.0",
28 35
     "mocha": "^6.2.0",
36
+    "process": "^0.11.10",
37
+    "stream-browserify": "^3.0.0",
38
+    "ts-loader": "^9.5.0",
29 39
     "ts-mocha": "^6.0.0",
30
-    "typescript": "^4.9.3"
40
+    "typescript": "^4.9.3",
41
+    "webpack": "^5.88.2",
42
+    "webpack-cli": "^5.1.4",
43
+    "webpack-utf8-bom": "^1.4.0"
31 44
   },
32 45
   "files": [
33 46
     "lib/src/main.js",

+ 46
- 0
webpack.js Dosyayı Görüntüle

@@ -0,0 +1,46 @@
1
+const path = require('path');
2
+const webpack = require('webpack');
3
+const BomPlugin = require('webpack-utf8-bom');
4
+
5
+module.exports = {
6
+  mode: 'production',
7
+  target: "web",
8
+  entry: path.resolve(__dirname, 'src', 'main.ts'),
9
+  output: {
10
+    path: path.resolve(__dirname, 'lib', 'browser'),
11
+    filename: "rjsvm.browser.js",
12
+    libraryTarget: 'window'
13
+  },
14
+  resolve: {
15
+    extensions: [".ts", ".tsx", ".js"],
16
+    fallback: {
17
+      "zlib": require.resolve("browserify-zlib"),
18
+      "http": require.resolve("stream-http"),
19
+      "https": require.resolve("https-browserify"),
20
+      "stream": require.resolve("stream-browserify") ,
21
+      "buffer": require.resolve('buffer/'),
22
+      "Buffer": require.resolve('buffer/'),
23
+      "url": require.resolve('url/'),
24
+      "crypto": require.resolve('crypto-browserify'),
25
+    }
26
+  },
27
+  module: {
28
+    rules: [
29
+      { test: /\.ts?$/, loader: "ts-loader" }
30
+    ]
31
+  },
32
+  optimization: {
33
+    minimize: true,
34
+  },
35
+  plugins: [
36
+    new webpack.ProvidePlugin({
37
+      Buffer: ['buffer', 'Buffer'],
38
+    }),
39
+    new webpack.ProvidePlugin({
40
+      process: 'process/browser.js',
41
+    }),
42
+    new BomPlugin(true)
43
+  ],
44
+  externals: {
45
+  }
46
+}

Loading…
İptal
Kaydet