Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes ESM bundle generation by adjusting webpack's external dependencies configuration. Previously, ESM bundles were failing because external libraries (rdflib and solid-logic) were being mapped to global variables instead of being preserved as bare module specifiers. The fix introduces a separate esmExternals configuration that keeps the original import names, allowing browsers to resolve them via import maps.
Key changes:
- Introduced new
esmExternalsconfiguration for ESM bundles in webpack that preserves bare module specifiers - Disabled
concatenateModulesoptimization for ESM builds to prevent module resolution issues - Added a working HTML example demonstrating ESM bundle usage with import maps
- Updated package version to 3.0.1 and several dependencies (solid-logic, mime-types, webpack, etc.)
- Updated documentation examples to reference the new versions
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| webpack.config.mjs | Added esmExternals configuration to preserve bare module imports for ESM builds; disabled concatenateModules optimization for ESM bundles |
| test/testBundles/test-bundle.html | New HTML example demonstrating ESM bundle usage with import maps, showing login/profile button functionality |
| package.json | Version bump to 3.0.1; updated dependencies (mime-types, solid-logic, TypeScript ESLint, jest, terser, webpack); removed unused @eslint/eslintrc |
| package-lock.json | Lock file updates matching package.json dependency changes |
| README.md | Updated ESM usage examples to pin specific versions (solid-logic@4.0.1, solid-ui@3.0.1) for consistency |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // ESM externals: keep imports | ||
| const esmExternals = { | ||
| rdflib: 'rdflib', | ||
| 'solid-logic': 'solid-logic' |
There was a problem hiding this comment.
There is trailing whitespace at the end of this line. Consider removing it for consistency.
| 'solid-logic': 'solid-logic' | |
| 'solid-logic': 'solid-logic' |
ESM bundles were not working due to external libs. Now it should work