Comments (4)
Hi @David-Yuen - thanks for this detail. Let's figure out how to get you working with 1.16.9 (and beyond).
The way I'm reading the most recent error is that you're requiring node_modules/@carbon/charts-react/dist/index.js and getting a message that it's an ES module and not UMD. But if we look at that file, we can visually see it's UMD because the file starts out with an IIFE.
It's being treated as an ES module because @carbon/charts-react
package.json's type
is module
. This treats .js files as ES modules even though that's not correct where the dist folder is concerned.
Can you try a quick experiment?
- In your node_modules/@carbon/charts-react/package.json, remove line 5 ("type": "module") and save.
- See if the error still occurs.
Also, can you share what version of webpack you are using as well as your webpack config?
Separate question, are you able to use import
instead of require
?
from carbon-charts.
@David-Yuen - we changed the exports for the UMD to use CJS in 1.16.10. Can you please check that and see if it solves your issue?
from carbon-charts.
@nstuyvesant I just tested 1.16.10
and it looks like the issue is resolved now, thanks.
I was going to try your quick experiment but you guys already fixed and delivered the 1.16.10, and that's working, so i think i dont need to test this now..
and answering the other questions:
We are using "webpack": "5.92.0"
, our webpack config is a bit complex, if you send me a slack message i can share it with you. We have one webpack config that builds client code in both node and web versions. We generally followed DAP's teams patterns.
and we generally use import
from all our reactjs files.. but after building, the files are compiled differently and not sure how it is actually executed.. We are using the @loadable/component
and @loadable/server
libraries for code splitting, so we have built routes to each of our SPAs. Our webpack config will build each of our SPAs for both node and web.. I just generally know the node and web compiled codes are quite different.
from carbon-charts.
Hi @David-Yuen - I am not inside of IBM so not on Slack but glad the update solved your issue.
Something that I have seen among Webpack users is inadvertent use of a cjs-loader. Normally, this is to convert ES modules to CJS. But if you wrote everything using import, you may not need it.
For sure, your generated bundles are CJS. You could look into whether that's really required. The benefit for going pure ESM is better tree-shaking. Of course, you are doing SSR so you would need to be using a recent version of node.js that supports ESM.
In any case, glad this blocker has been overcome. All the best.
from carbon-charts.
Related Issues (20)
- [Enhancement]: Allow repeating name in different categories in Alluvial charts
- [Bug]: `ccv-gauge-chart` Not Displaying Correctly in Production - `this.getHolder()` from the core is not working HOT 1
- AVT1 Violation in GaugeChart component
- [Bug]: Exported CSV encoding in Excel
- [Task]: Add Angular version tags to previous versions
- [Bug]: export as png and expost as jpg giving error on safari 17 HOT 2
- Keyboard opearability in HistogramChart
- [Bug]: Missing tick labels in timeseries line and bar charts. HOT 1
- [Bug]: Duplicate tick labels in timeseries line/bar charts. HOT 1
- [Accessibility]: aria-label of charts toolbar all have same ID
- [Accessibility]: Simple bar chart bars with value 0 do not have aria-label
- [Enhancement]:
- Does `@carbon/charts-react` support React 17? HOT 1
- [Bug]: BarChartGrouped is missing the following properties: chart, ref
- [Bug]: StackedBarChartOptions is missing from the typescript exports for carbon charts react
- [Bug]: Redefined variables violating no-shadow rule
- [Bug]: Warnings from missing properties
- [Bug]: Cannot find module 'topojson-specification' or its corresponding type declarations
- [Bug]: Selecting the legend on a StackedBarChart doesn't work if data is loaded in after the initial load
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from carbon-charts.