Giter Club home page Giter Club logo

Comments (7)

JorritSalverda avatar JorritSalverda commented on July 21, 2024 1

The suggested Vite config addition from the other ticket actually worked wonders. Thx.

  ssr: {
    noExternal: [/^d3.*$/, /^@nivo.*$/],
  },

from nivo.

JorritSalverda avatar JorritSalverda commented on July 21, 2024

Perhaps a useful article on how to make the library work well for both ESM and CommonJS: https://www.maxpou.fr/blog/publish-npm-package-esm-and-cjs/

from nivo.

JorritSalverda avatar JorritSalverda commented on July 21, 2024

You might also want to switch from lodash to lodash-es so you can use imports like import { cloneDeep } from 'lodash-es' while benefiting from ESM's tree shaking to minimize the end users bundle size.

from nivo.

plouc avatar plouc commented on July 21, 2024

I think it's a duplicate of #2310.

from nivo.

JorritSalverda avatar JorritSalverda commented on July 21, 2024

Could be but everyone wants to discontinue the commonjs version while the exports skips the need to do so, keeping only the lodash afterwards. I've managed to get it to work locally by patching nivo by both adding the exports section to all nivo package.json files and by adding the .js extension suffix to all lodash imports. I'll try to create a pull request for both.

from nivo.

plouc avatar plouc commented on July 21, 2024

everyone wants to discontinue the commonjs version while the exports skips the need to do so

There are many tools out there, some with their own way of loading things, I think that's a bold assumption.

from nivo.

plouc avatar plouc commented on July 21, 2024

I'm going to close this issue, as it's clearly related.

from nivo.

Related Issues (20)

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.