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

Update npm package structure #327

Merged
merged 4 commits into from
Dec 3, 2023
Merged

Conversation

kateinoigakukun
Copy link
Member

@kateinoigakukun kateinoigakukun commented Dec 3, 2023

  1. Files are now organized as follows to fix ESM imports12:
  • dist/*.cjs.js -> dist/cjs/*.js
  • dist/*.esm.js -> dist/esm/*.js
  1. dist/{cjs,esm}/**/*.js are now not bundled with rollup to avoid
    duplicated bundling.

Footnotes

  1. UMD files are kept in the root of dist/ to avoid breaking
    existing code that loads them from CDN instead of package.json's
    exports field.

  2. ESM imports were broken with Node.js because files are not
    suffixed with mjs nor type: module is not specified in root
    package.json. Now dist/esm/package.json specifies type: module.

@kateinoigakukun kateinoigakukun force-pushed the katei/restructure-npm-pkg branch from 8efa77c to ffc66c0 Compare December 3, 2023 11:09
1. Files are now organized as follows to fix ESM imports[^1][^2]:
- `dist/*.cjs.js` -> `dist/cjs/*.js`
- `dist/*.esm.js` -> `dist/esm/*.js`

2. `dist/{cjs,esm}/**/*.js` are now not bundled with rollup to avoid
   duplicated bundling.

[^1]: UMD files are kept in the root of `dist/` to avoid breaking
      existing code that loads them from CDN instead of `package.json`'s
      `exports` field.
[^2]: ESM imports were broken with Node.js because files are not
      suffixed with mjs nor `type: module` is not specified in root
      `package.json`. Now `dist/esm/package.json` specifies `type: module`.
`dist/esm/browser.js` in `@ruby/wasm-wasi` no longer contains polyfills
for Node.js, so we need to bundle them in the version-specific packages.
It would be better to fail the test on uncaught exception compared to
timeout.
@kateinoigakukun kateinoigakukun force-pushed the katei/restructure-npm-pkg branch from 2c497e3 to 06a03b0 Compare December 3, 2023 11:51
@kateinoigakukun kateinoigakukun marked this pull request as ready for review December 3, 2023 12:35
@kateinoigakukun kateinoigakukun merged commit c7f3a88 into main Dec 3, 2023
@kateinoigakukun kateinoigakukun deleted the katei/restructure-npm-pkg branch December 3, 2023 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant