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

feat!: default .js as ESM, CJS to .cjs & build target ES2021 #171

Merged
merged 5 commits into from
Nov 22, 2023

Conversation

ghiscoding
Copy link
Owner

@ghiscoding ghiscoding commented Nov 21, 2023

  • this breaking PR will however make the ESM as default with .js file extension by following Vite's Deprecate CJS Node API recommendations while staying hybrid (CJS/ESM)
  • bump build target to ES2021
  • change .js extension to default as ESM and provide .cjs extension for users who want CJS and keep supporting hybrid mode (CJS/ESM)
  • move legacy <script> loading from dist/ root to dist/browser/multiple-select.{js,cjs} ("browser" is meant for legacy script loading)
    • ESM: <script type="module" src="https://cdn.jsdelivr.net/npm/multiple-select-vanilla@1.0.0/dist/browser/multiple-select.js"></script>
    • CJS: <script src="https://cdn.jsdelivr.net/npm/multiple-select-vanilla@1.0.0/dist/browser/multiple-select.cjs"></script>
  • move all locales bundle from dist/ to dist/locales/multiple-select-all-locales.{js,cjs}

- this breaking PR should make the lib fully support ESM ready following Vite's [Deprecate CJS Node API](https://vitejs.dev/guide/migration.html#migration-from-v4) recommendations
- bump build target from ES2018 to ES2021
- drop `.js` ouputs and now only build as `.cjs` and `.mjs` to be fully ESM ready while still supporting hybrid mode (CJS/ESM)
- move legacy `<script>` loading to `browser/multiple-select.{cjs,mjs}`
- move all locales from `dist/` to `dist/locales/multiple-select-all-locales.{cjs,mjs}`
Copy link

github-actions bot commented Nov 21, 2023

🎭 Playwright Summary - Success 🎉

Playwright Report

multiple-select-vanilla-root@0.0.0 test:e2e /home/runner/work/multiple-select-vanilla/multiple-select-vanilla
playwright test --config playwright/playwright.config.ts

Running 69 tests using 2 workers
·····································································
69 passed (56.2s)

@ghiscoding ghiscoding marked this pull request as draft November 21, 2023 06:15
@ghiscoding ghiscoding changed the title feat!: drop .js instead build as .cjs and .mjs and target ES2021 feat!: drop .js move to .cjs and .mjs builds + target ES2021 Nov 21, 2023
@ghiscoding ghiscoding marked this pull request as ready for review November 22, 2023 01:05
@ghiscoding ghiscoding changed the title feat!: drop .js move to .cjs and .mjs builds + target ES2021 feat!: default .js as ESM and move to .cjs for CJS and build target ES2021 Nov 22, 2023
@ghiscoding ghiscoding changed the title feat!: default .js as ESM and move to .cjs for CJS and build target ES2021 feat!: default .js as ESM, CJS to .cjs & build target ES2021 Nov 22, 2023
@ghiscoding ghiscoding merged commit 5e99b03 into main Nov 22, 2023
2 checks passed
@ghiscoding ghiscoding deleted the feat/cjs-mjs-exports branch November 22, 2023 01:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant