Isomorphic build support
See original GitHub issueChart.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"
topackage.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:
- Created 2 years ago
- Reactions:5
- Comments:6 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@rpf3 it will be released in v4. You can follow the progress here
https://github.com/chartjs/Chart.js/milestone/23
@dangreen any idea when it will be released?