Skip to content

Fixing module resolution within IDEs#592

Merged
mcottontensor merged 2 commits intoEpicGamesExt:masterfrom
mcottontensor:ide_fix
Apr 10, 2025
Merged

Fixing module resolution within IDEs#592
mcottontensor merged 2 commits intoEpicGamesExt:masterfrom
mcottontensor:ide_fix

Conversation

@mcottontensor
Copy link
Copy Markdown
Collaborator

Problem statement:

I noticed recently that my IDE was complaining about not finding certain imports which was breaking a lot of intellisense stuff. Turns out if was related to recent tsconfig changes.

Solution

In the base tsconfig of each project I have changed the moduleResolution to 'bundler' which allows the IDE to properly resolve all imports since it only looks at the base tsconfig.json and not the module specific cjs or esm versions.
Additionally I have set moduleResolution to 'node10' in the cjs configs since this is the default setting for cjs modules. The esm versions already had the proper setting. This ensures that the bundler setting is properly changed in each actual build.

Without these changes the IDE fails to find some imports and made it
hard for things like intellisense and auto complete etc.
It shouldn't make a difference with actual builds because the
moduleResolution is overridden anyway.
node10 is the default moduleResolution for cjs projects so this is just
explicitly setting that so that the bundler entry from the base gets
properly overwritten.
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 10, 2025

⚠️ No Changeset found

Latest commit: 5fa69cc

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@mcottontensor mcottontensor added auto-backport Used to specify we want a PR to auto backport to a branch, must be paired with auto-backport-to-UEX. auto-backport-to-UE5.5 labels Apr 10, 2025
@mcottontensor mcottontensor merged commit f3e0e91 into EpicGamesExt:master Apr 10, 2025
6 checks passed
@mcottontensor mcottontensor deleted the ide_fix branch April 10, 2025 02:21
github-actions bot pushed a commit that referenced this pull request Apr 10, 2025
* Fixing tsconfigs to help IDEs resolve imports.

Without these changes the IDE fails to find some imports and made it
hard for things like intellisense and auto complete etc.
It shouldn't make a difference with actual builds because the
moduleResolution is overridden anyway.

* Explicitly setting CJS projects to node10 moduleResolution.

node10 is the default moduleResolution for cjs projects so this is just
explicitly setting that so that the bundler entry from the base gets
properly overwritten.

(cherry picked from commit f3e0e91)
@github-actions
Copy link
Copy Markdown
Contributor

💚 All backports created successfully

Status Branch Result
UE5.5

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation and see the Github Action logs for details

mcottontensor added a commit that referenced this pull request Apr 10, 2025
* Fixing tsconfigs to help IDEs resolve imports.

Without these changes the IDE fails to find some imports and made it
hard for things like intellisense and auto complete etc.
It shouldn't make a difference with actual builds because the
moduleResolution is overridden anyway.

* Explicitly setting CJS projects to node10 moduleResolution.

node10 is the default moduleResolution for cjs projects so this is just
explicitly setting that so that the bundler entry from the base gets
properly overwritten.

(cherry picked from commit f3e0e91)

Co-authored-by: mcottontensor <80377552+mcottontensor@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-backport Used to specify we want a PR to auto backport to a branch, must be paired with auto-backport-to-UEX. auto-backport-to-UE5.5

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant