You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a newly created webpack app is configured to use incremental builds with buildLibsFromSource: false, libraries that it imports using a custom tsconfig paths entry are not resolved.
Expected Behavior
Webpack apps should resolve libraries imported using entries defined in tsconfig paths.
> nx run webpack-app:build
> webpack-cli build --node-env=production
chunk (runtime: main) main.js (main) 711 bytes [entry] [rendered]
ERROR in ./src/main.ts 4:18-44
Module not found: Error: Can't resolve '@custom/my-util' in '/home/joshua/WebDev/projects/nx/debug-nx-webpack-tsconfig-paths/webpack-app/src'webpack compiled with 1 error (651e19a49e926f4c)Warning: command "webpack-cli build --node-env=production" exited with non-zero status code
Package Manager Version
No response
Operating System
macOS
Linux
Windows
Other (Please specify)
Additional Information
Although not demonstrated in this reproduction, the most common way to experience this error is likely from defining wildcard * entries in tsconfig.base.json and not having them be resolved by webpack on incremental builds. This has been a commonly reported issue, so it's worth noting that loading tsconfig paths wildcard entries has been correctly implemented for nx/node targets using webpack, and should work fine once either this issue is fixed or the workaround I'll post in the replies is implemented.
The text was updated successfully, but these errors were encountered:
This issue is caused by Nx not correctly resolving a relative path to the app's tsconfig to the workspace root. The workaround for this issue is to create an additional tsconfig file that will correctly resolve relative to project root and have it extend your app's tsconfig file.
For example, if you have an app called myapp with a tsconfig located at apps/myapp/tsconfig.app.json, then you should create the following file: apps/myapp/apps/myapp/tsconfig.app.json with the following contents:
Current Behavior
When a newly created webpack app is configured to use incremental builds with
buildLibsFromSource: false
, libraries that it imports using a custom tsconfigpaths
entry are not resolved.Expected Behavior
Webpack apps should resolve libraries imported using entries defined in tsconfig
paths
.GitHub Repo
https://github.com/JoshuaCWebDeveloper/debug-nx-webpack-tsconfig-paths
Steps to Reproduce
paths
entry intsconfig.base.json
:ajv@8
dependency topackage.json
:packages/webpack-app/src/main.ts
:packages/webpack-app/webpack.config.js
:Nx Report
Failure Logs
Package Manager Version
No response
Operating System
Additional Information
Although not demonstrated in this reproduction, the most common way to experience this error is likely from defining wildcard
*
entries intsconfig.base.json
and not having them be resolved by webpack on incremental builds. This has been a commonly reported issue, so it's worth noting that loading tsconfigpaths
wildcard entries has been correctly implemented fornx/node
targets usingwebpack
, and should work fine once either this issue is fixed or the workaround I'll post in the replies is implemented.The text was updated successfully, but these errors were encountered: