Force webpack to use a lib e.g: buffer #9937
Answered
by
shirakaba
abdallahkadour
asked this question in
Q&A
-
How I can do that in config.webpack.js: webpack.chainWebpack((config) => {
config.plugins = [
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer']
})
] I got an error saying ProvidePlugin is not a constructor |
Beta Was this translation helpful? Give feedback.
Answered by
shirakaba
Jun 16, 2022
Replies: 1 comment 1 reply
-
For anyone else reading: make sure that you install the npm install --save buffer I'm not actually sure whether both of these blocks are needed, but this worked in my case. config.resolve.set('fallback', {
Buffer: require.resolve('buffer'),
});
config
.plugin('BufferPlugin')
.use(require.resolve('webpack/lib/ProvidePlugin'), [
{ Buffer: ['buffer', 'Buffer'] },
]); |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
abdallahkadour
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For anyone else reading: make sure that you install the
buffer
node module, for one thing.I'm not actually sure whether both of these blocks are needed, but this worked in my case.