fix webpack polyfills

This commit is contained in:
Mason 2023-11-27 19:56:01 -06:00
parent 7bfd22315f
commit 593c6a26df
7 changed files with 7123 additions and 2 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -3,8 +3,11 @@
"dependencies": {
"@dynamic-labs/flow": "^0.19.3",
"@dynamic-labs/sdk-react-core": "^0.19.3",
"buffer": "^6.0.3",
"process": "^0.11.10",
"react": "^18.2.0",
"reactstrap": "^8.9.0",
"stream-browserify": "^3.0.0",
"viem": "1.5.3"
},
"devDependencies": {

View File

@ -1,4 +1,5 @@
var path = require('path');
const webpack = require('webpack');
module.exports = {
entry: path.join(__dirname, 'srcjs', 'dynamic_button.jsx'),
@ -22,6 +23,16 @@ module.exports = {
}
]
},
plugins: [
// Work around for Buffer is undefined:
// https://github.com/webpack/changelog-v5/issues/10
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
}),
new webpack.ProvidePlugin({
process: 'process/browser',
}),
],
externals: {
'react': 'window.React',
'react-dom': 'window.ReactDOM',
@ -30,5 +41,13 @@ module.exports = {
stats: {
colors: true
},
devtool: 'source-map'
devtool: 'source-map',
resolve: {
extensions: [ '.ts', '.js' ],
fallback: {
"stream": require.resolve("stream-browserify"),
"buffer": require.resolve("buffer"),
"process/browser": require.resolve("process/browser"),
}
},
};

File diff suppressed because it is too large Load Diff

View File

@ -5388,6 +5388,11 @@ process-warning@^1.0.0:
resolved "https://registry.yarnpkg.com/process-warning/-/process-warning-1.0.0.tgz#980a0b25dc38cd6034181be4b7726d89066b4616"
integrity sha512-du4wfLyj4yCZq1VupnVSZmRsPJsNuxoDQFdCFHLaYiEbFBD7QE0a+I4D7hOxrVnh78QE/YipFAj9lXHiXocV+Q==
process@^0.11.10:
version "0.11.10"
resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182"
integrity sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==
prop-types@^15.5.8, prop-types@^15.6.1, prop-types@^15.6.2:
version "15.8.1"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.8.1.tgz#67d87bf1a694f48435cf332c24af10214a3140b5"