Coder Social home page Coder Social logo

Comments (6)

sebinsua avatar sebinsua commented on May 4, 2024 114

@chaitanyapotti

You will also need this, to auto-import Buffer from your buffer alias wherever it finds it:

new webpack.ProvidePlugin({
  Buffer: ['buffer', 'Buffer'],
})

See: duplotech/create-react-app@d0be703

from changelog-v5.

chaitanyapotti avatar chaitanyapotti commented on May 4, 2024 1

@DanielRuf
I'm building a library which creates a umd, cjs builds. I use some packages which require Buffer polyfill.
What configuration should i use so that Buffer module gets polyfilled in my outputs.?

I tried resolve alias field and it didn't work for Buffer. ( it worked for others like crypto, process etc)

from changelog-v5.

DanielRuf avatar DanielRuf commented on May 4, 2024

https://github.com/feross/buffer is for example a solution for the browser but it depends on the library that you use. This is not a really a problem with webpack itself imo.

from changelog-v5.

DanielRuf avatar DanielRuf commented on May 4, 2024

Buffer in general is not part of the browser APIs and only a NodeJS API.

from changelog-v5.

DanielRuf avatar DanielRuf commented on May 4, 2024

Regarding the browser field, see https://webpack.js.org/configuration/resolve/#resolvealiasfields and webpack/webpack#151

If this does not work try importing directly https://unpkg.com/browse/[email protected]/dist/es/browser.js

from changelog-v5.

chaitanyapotti avatar chaitanyapotti commented on May 4, 2024

Thanks @sebinsua
That seems to have resolved that issue. However, when i try to use libraryTarget: "module",
i get the following error:
Module external type is not implemented yet

Is the feature not yet built?

from changelog-v5.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.