visa-chart-components icon indicating copy to clipboard operation
visa-chart-components copied to clipboard

Package Json wrong

Open jogibear9988 opened this issue 3 years ago • 9 comments

I wont to include your npm modules directly as esm but your package json is wrong.

the export: "module" points to "dist/index.js" wich has this code:

  export * from './esm-es5/index.js'; 

but the index.js in esm-es5 is empty

jogibear9988 avatar Nov 19 '22 20:11 jogibear9988

any news to this? I try to use your components in my designer: https://node-projects.github.io/web-component-designer-demo/index.html But for this the exports need to be correct.

jogibear9988 avatar Feb 05 '23 18:02 jogibear9988

Thanks for sharing this with us. I'm one of the maintainers of the project.

Could you please provide me with a simple reproduction where you run into this issue?

david-kutas avatar Feb 06 '23 23:02 david-kutas

As I explained, I create a Designer wich directly can load npm packages from unpkg (or other providers). It then parses the package.json, loads dependecies and at last loads the exports from the package.json

If you look at your package.json here: https://www.npmjs.com/package/@visa/charts?activeTab=explore you see, your "main" export is "dist/index.cjs.js" but if you use es6 modules, you normaly look for the "modules" exoport in the package.json, wich leads to "dist/index.js" wich then leads to the empty import. The cjs export cannot directly be used by the browser. Also the package.json normaly shoul export the es6 code via "export" definition. But at first your "modules" export should work

jogibear9988 avatar Feb 07 '23 20:02 jogibear9988

also when you look at your other export "dist/esm/index.js", it is also empty

jogibear9988 avatar Feb 07 '23 20:02 jogibear9988

https://watch.screencastify.com/v/0cBoi7zxDj5LMQ94nxiM

jogibear9988 avatar Feb 07 '23 20:02 jogibear9988

Thank you for the explanation, we are investigating the issue. I'll get back as soon as I have some sort of a recommendation/resolution to the issue.

david-kutas avatar Feb 07 '23 22:02 david-kutas

Just an extra thought: Would there be a way for you to overwrite the default import behavior on your side (within your designer application)?

david-kutas avatar Feb 07 '23 22:02 david-kutas

i wrote the import behavior, as it i defined in node. why do you deliver empy javascript files? ad I cannot load cjs from the browser. from where should I know wich files to load in your library?

jogibear9988 avatar Feb 08 '23 05:02 jogibear9988

Thank you for the inputs. We are further investigating the problem. As soon as I have some details on this, I'll get back.

david-kutas avatar Feb 16 '23 19:02 david-kutas