Skip to content

Force webpack to use a lib e.g: buffer #9937

Answered by shirakaba
abdallahkadour asked this question in Q&A
Discussion options

You must be logged in to vote

For anyone else reading: make sure that you install the buffer node module, for one thing.

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'] },
]);

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@abdallahkadour
Comment options

Answer selected by abdallahkadour
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants