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

Add missing support for subpaths #253

Merged
merged 1 commit into from
Jul 2, 2024
Merged

Add missing support for subpaths #253

merged 1 commit into from
Jul 2, 2024

Conversation

hl662
Copy link
Contributor

@hl662 hl662 commented Jul 2, 2024

When using export and subpaths, to fully support CJS and ESM, we need each subpath to contain import and require.

Previously, ./Renderer didn't support CJS, because it didn't have a require field. This would cause problems in packages, like itwinjs/core core-full-stack-tests, that consumes both Main and Renderer, but outputs CJS files. At build time, this wouldn't be caught, but during runtime, it would throw a PACKAGE_PATH_NOT_SUPPORTED, because when it tried to use the Renderer subpath, it couldn't find a valid CJS path.

Vice versa, with ./Main in ESM outputted files.

This issue is fixed by adding both import and require and their valid values to each subpath.

@ben-polinsky
Copy link
Collaborator

Excellent. I ran into this setting up my docs cospace the other day. Thanks!

@hl662 hl662 enabled auto-merge (squash) July 2, 2024 20:44
@hl662 hl662 merged commit 25a2827 into main Jul 2, 2024
13 checks passed
@hl662 hl662 deleted the nam/subpath-support branch July 2, 2024 20:59
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.

3 participants