1
0
mirror of https://github.com/sasjs/adapter.git synced 2025-12-11 01:14:36 +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-extended": "^0.11.5",
"mime": "^2.5.2",
"node-polyfill-webpack-plugin": "^1.1.4",
"path": "^0.12.7",
"process": "^0.11.10",
"rimraf": "^3.0.2",
@@ -64,12 +65,11 @@
},
"main": "index.js",
"dependencies": {
"@sasjs/utils": "^2.21.0",
"@sasjs/utils": "^2.22.0",
"axios": "^0.21.1",
"axios-cookiejar-support": "^1.0.1",
"form-data": "^4.0.0",
"https": "^1.0.0",
"jwt-decode": "^3.1.2",
"tough-cookie": "^4.0.0",
"url": "^0.11.0"
}

View File

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