Skip to content

refactor: convert to ESM modules like sass-loader#593

Merged
alexander-akait merged 1 commit into
mainfrom
claude/convert-to-esm-cdqVY
May 20, 2026
Merged

refactor: convert to ESM modules like sass-loader#593
alexander-akait merged 1 commit into
mainfrom
claude/convert-to-esm-cdqVY

Conversation

@alexander-akait
Copy link
Copy Markdown
Member

  • Set "type": "module" in package.json
  • Build both ESM (dist/esm) and CJS (dist/cjs) outputs via babel env-name
  • Add exports field with import/require conditions
  • Use import attributes (with { type: "json" }) for the schema
  • Load less via dynamic await import() with file-URL normalization
  • Drop src/cjs.js; append CJS interop to dist/cjs/index.js at build time
  • Convert remaining config files (commitlint, lint-staged, eslint) to ESM
  • Replace jest with Node's built-in test runner
  • Convert all tests, helpers and fixtures to ESM (use fileURLToPath for
    __dirname, top-level imports instead of require)
  • Add test/setup-snapshots.js to keep snapshots under test/snapshots/
  • Bump engines and babel target to Node >= 22.11.0

@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla Bot commented May 19, 2026

CLA Not Signed

@alexander-akait alexander-akait force-pushed the claude/convert-to-esm-cdqVY branch 3 times, most recently from 46603e6 to 8203660 Compare May 20, 2026 09:54
- Set "type": "module" in package.json
- Add `exports` field with import/require conditions; build to dist/esm and dist/cjs
- Source uses `import schema from "./options.json" with { type: "json" }`
  and `.js`-suffixed relative imports
- Load less via `await import(normalizeImportSpecifier(pkg))`; the babel
  CommonJS transform now skips dynamic-import lowering so the CJS dist
  keeps native `import()`
- Drop src/cjs.js and test/cjs.test.js (obsolete with dual build)
- Point test getCompiler at dist/cjs/index.js
- Allow ES2025 syntax in eslint
- Convert lint-staged.config.js to ESM
- Remove commitlint entirely: config file, npm script, husky commit-msg
  hook, devDependencies, .cspell word, and CI step
@alexander-akait alexander-akait force-pushed the claude/convert-to-esm-cdqVY branch from 8203660 to ce3ec35 Compare May 20, 2026 10:01
@alexander-akait alexander-akait merged commit 9680de8 into main May 20, 2026
11 of 12 checks passed
@alexander-akait alexander-akait deleted the claude/convert-to-esm-cdqVY branch May 20, 2026 10:13
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.

2 participants