1
0
mirror of https://github.com/sasjs/adapter.git synced 2026-01-04 11:10:05 +00:00

fix(build): add node polyfill plugin and stub fs and readline when building for the browser

This commit is contained in:
Krishna Acondy
2021-07-01 09:11:03 +01:00
parent 5d77bbba8b
commit 5a35237de5
3 changed files with 2073 additions and 13 deletions

2076
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -46,6 +46,7 @@
"jest": "^27.0.6", "jest": "^27.0.6",
"jest-extended": "^0.11.5", "jest-extended": "^0.11.5",
"mime": "^2.5.2", "mime": "^2.5.2",
"node-polyfill-webpack-plugin": "^1.1.4",
"path": "^0.12.7", "path": "^0.12.7",
"process": "^0.11.10", "process": "^0.11.10",
"rimraf": "^3.0.2", "rimraf": "^3.0.2",
@@ -64,12 +65,11 @@
}, },
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@sasjs/utils": "^2.21.0", "@sasjs/utils": "^2.22.0",
"axios": "^0.21.1", "axios": "^0.21.1",
"axios-cookiejar-support": "^1.0.1", "axios-cookiejar-support": "^1.0.1",
"form-data": "^4.0.0", "form-data": "^4.0.0",
"https": "^1.0.0", "https": "^1.0.0",
"jwt-decode": "^3.1.2",
"tough-cookie": "^4.0.0", "tough-cookie": "^4.0.0",
"url": "^0.11.0" "url": "^0.11.0"
} }

View File

@@ -1,6 +1,7 @@
const path = require('path') const path = require('path')
const webpack = require('webpack') const webpack = require('webpack')
const terserPlugin = require('terser-webpack-plugin') const terserPlugin = require('terser-webpack-plugin')
const nodePolyfillPlugin = require('node-polyfill-webpack-plugin')
const defaultPlugins = [ const defaultPlugins = [
new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /en/), new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /en/),
@@ -37,7 +38,7 @@ const browserConfig = {
}, },
resolve: { resolve: {
extensions: ['.ts', '.js'], extensions: ['.ts', '.js'],
fallback: { https: false } fallback: { https: false, fs: false, readline: false }
}, },
output: { output: {
filename: 'index.js', filename: 'index.js',
@@ -49,7 +50,8 @@ const browserConfig = {
...defaultPlugins, ...defaultPlugins,
new webpack.ProvidePlugin({ new webpack.ProvidePlugin({
process: 'process/browser' process: 'process/browser'
}) }),
new nodePolyfillPlugin()
] ]
} }