Skip to content

Commit

Permalink
Merge pull request #270 from ringcentral/RC-269
Browse files Browse the repository at this point in the history
[FIX] Resolve "Buffer is undefined" Error in Webpack Configuration
  • Loading branch information
SushilMallRC authored Aug 26, 2024
2 parents 28b7a6b + e69a18f commit aa2716d
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion utils/webpack.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
function createConfig({entry, filename, outputPath, libraryName, externals}) {
const webpack = require('webpack');

function createConfig({ entry, filename, outputPath, libraryName, externals }) {
const common = {
mode: 'production',
devtool: 'source-map',
Expand All @@ -12,6 +14,16 @@ function createConfig({entry, filename, outputPath, libraryName, externals}) {
},
],
},
plugins: [
// Workaround for Buffer is undefined:
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
}),
// Workaround for process is undefined:
new webpack.ProvidePlugin({
process: 'process/browser',
}),
],
resolve: {
extensions: ['.tsx', '.ts', '.js'],
fallback: {
Expand Down

0 comments on commit aa2716d

Please sign in to comment.