question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Isomorphic build support

See original GitHub issue

Chart.js does not work with Vite / SvelteKit out of the box. This is because Chart.js provides a build via the main field in package.json which provides just a default export. Meanwhile it provides a build in module which provides named exports. Vite tries to use the module build on the client and the main build on the server which causes the build to fail because you can’t write code that is compatible with both these packages. To work around this, you can specify the option vite.ssr.noExternal: ['chart.js'], but this is hard for users to figure out and it’d be much nicer to provide builds that are the same shapte

There are a couple things we could do:

  • We should put a build in main that uses the same entry file as our ESM build and add "type": "module" to package.json. This is probably the best option
  • We could remove main. Chart.js isn’t really that useful on the server-side, so we could just stop telling Vite that we have a server-side build. It would still try to build it on the server, but would fallback to the ESM implementation

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:5
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
dangreencommented, Aug 8, 2022

@rpf3 it will be released in v4. You can follow the progress here

https://github.com/chartjs/Chart.js/milestone/23

0reactions
rpf3commented, Aug 8, 2022

@dangreen any idea when it will be released?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Isomorphic JavaScript: The Future of Web Apps - Medium
Meteor is probably the most well-known isomorphic project today. Meteor is built from the ground up to support real-time apps, and the team ......
Read more >
Building Isomorphic JavaScript Apps [Book] - O'Reilly
Isomorphic JavaScript applications are the perfect union of the classic web application and single-page application architectures. They offer: SEO support using ...
Read more >
What is an isomorphic application? - Lullabot
Isomorphic applications are fast, SEO friendly, and help you to write less ... The asset /build/bundle.js is the React web application, ...
Read more >
Patch & Development Builds | Isomorphic Software - SmartClient
Patch Builds: a "patch" build contains bugfixes, documentation updates and locale ... If you have a support contract with Isomorphic, you can get...
Read more >
isomorphic-git · A pure JavaScript implementation of git for ...
Works in All Modern Browsers. Clone repos, create commits, push branches and more in client-side JS.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found