Skip to content

Conversation

@RobinMalfait
Copy link
Member

@RobinMalfait RobinMalfait commented Nov 19, 2024

This PR uses the enhanced-resolve instead of createRequire(…).resolve which improves the usability when running the upgrade tool locally using Bun.

While testing, we also noticed that it is not possible to use a cjs-only plugin inside of an esm project. It was also not possible to use an esm-only plugin inside of a cjs project.

Test plan

We added integration tests in both the CLI (the CLI is an mjs project) and in the PostCSS (where we can configure a cjs and esm PostCSS config) integration tests where we created an esm and cjs based project with 4 plugins (cjs-only, esm-only, and TypeScript based plugins: cts-only and mts-only).

@RobinMalfait RobinMalfait requested a review from a team as a code owner November 19, 2024 15:42
When using Bun, it looks like the `createRequire(…)` doesn't work as
expected if you run the script from a different location (even if you
provide the base path).

We already use enhanced resolver which we can re-use for this.
@RobinMalfait RobinMalfait force-pushed the fix/use-enhance-resolve branch from b70f7dc to edaef14 Compare November 19, 2024 17:04
@RobinMalfait RobinMalfait merged commit fe9fc9a into next Nov 19, 2024
1 check passed
@RobinMalfait RobinMalfait deleted the fix/use-enhance-resolve branch November 19, 2024 17:39
thecrypticace pushed a commit that referenced this pull request Nov 19, 2024
This PR updates the `jiti` dependency we use for plugin loading to the
latest stable release.

## Test Plan

This was relying on integration tests which contains example of
TypeScript configs. It's also rebased to include the new examples from
#15041.
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.

4 participants