Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IDEA] distribute as all module types {CJS,ESM,UMD,AMD} #18

Open
jkowalleck opened this issue Apr 15, 2022 · 5 comments
Open

[IDEA] distribute as all module types {CJS,ESM,UMD,AMD} #18

jkowalleck opened this issue Apr 15, 2022 · 5 comments
Labels
build process enhancement New feature or request help wanted Extra attention is needed javascript Pull requests that update Javascript code

Comments

@jkowalleck
Copy link
Member

jkowalleck commented Apr 15, 2022

currently, the package is a CommonJS module type.
I would love to make it a native module type (ESM).

Goal: have the dist available in multiple flavors

  • ESM for browser
  • commonJS for browser
  • esm for node
  • commonjs for node
  • umd ...
  • amd ...
  • ... etc ...

Important to READ:

implementation:

@jkowalleck jkowalleck added the javascript Pull requests that update Javascript code label Apr 15, 2022
@jkowalleck jkowalleck self-assigned this Apr 15, 2022
@jkowalleck jkowalleck added the help wanted Extra attention is needed label Apr 15, 2022
@jkowalleck jkowalleck changed the title [DRAFT] make a ESM distribute as all module types Apr 29, 2022
@jkowalleck jkowalleck changed the title distribute as all module types [DRAFT] distribute as all module types May 27, 2022
@jkowalleck jkowalleck removed the help wanted Extra attention is needed label May 27, 2022
@jkowalleck jkowalleck removed their assignment Jun 3, 2022
@agschrei
Copy link

are there still plans to produce an ESM for the browser?
I got it to work as an import in my vite project by forking and altering the package.json to:

  • skip the webpack step in the build phase
  • point to the index.web.js as main

of course I'd rather see support for this use-case added upstream as opposed to maintaining a fork, so please let me know if I can help.

@jkowalleck
Copy link
Member Author

Moin @agschrei,

yes, the idea is still relevant.
feel free to (draft) pullrequest a (partial) solution.

@jkowalleck jkowalleck changed the title [DRAFT] distribute as all module types [DRAFT] distribute as all module types {CJS,ESM,UMD,AMD} Dec 24, 2022
@jkowalleck jkowalleck added build process enhancement New feature or request help wanted Extra attention is needed labels Dec 24, 2022
@jkowalleck
Copy link
Member Author

@agschrei are you still interested in contributing your solution?

@eknowles
Copy link

I'm not attached to this project but I support this use case. As the front-end industry moves towards ESM for dev builds being able to validate SBOM production as early as possible is very helpful.

@jkowalleck jkowalleck changed the title [DRAFT] distribute as all module types {CJS,ESM,UMD,AMD} [IDEA] distribute as all module types {CJS,ESM,UMD,AMD} Dec 6, 2023
@jkowalleck
Copy link
Member Author

This feature is kind of obsolete, now.
There are tests, that show that this library is able to run in ESM context, so no additional work seams to be needed at the moment.
see https://github.com/CycloneDX/cyclonedx-javascript-library/blob/main/examples/node/javascript/example.mjs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build process enhancement New feature or request help wanted Extra attention is needed javascript Pull requests that update Javascript code
Projects
None yet
Development

No branches or pull requests

3 participants