-
Notifications
You must be signed in to change notification settings - Fork 12k
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
Generated Source Maps using absolute paths #17046
Comments
@alan-agius4 How should this error be fixed? Should we set all projectRoot to |
@xiaoxiangmoe, no you shouldn't amend the root to "", as this might cause issues when using There needs to be a fix for this in build-angular. |
Will this fix be brought in next month's Angular 10 release? |
@xiaoxiangmoe I agree with @alan-agius4 , changing the root to the workspace dir breaks many scripts, including for example many of the schematics included in @nrwl/nx. We're currently using a simple custom Webpack config and didn't experience any problems yet. const path = require('path');
module.exports = {
context: path.resolve(__dirname, '..')
}; The config lies in a folder called The builder we're using is @angular-builders/custom-webpack. |
This issue causes debugging problem using VSCode Remote Extensions. Breakpoints will not work until custom |
… paths in monorepo With this change we fix the issue that when having a monorepo style workspace, sourcemaps sources references absolute paths. Closes #17046
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
🐞 Bug report
Command (mark with an
x
)Is this a regression?
I don't think so.
Description
When building an Angular application that imports a local library, the source maps for files outside of the apps' folder contain absolute paths instead of relative ones.
This happens because the context for the default Webpack config generated by the CLI internally is set to
projectRoot
. Webpack shortens the paths by looking into the current and the parent directory, which is not enough for the provided setup.I propose to use either the TSConfig
baseUrl
as the context for the Webpack config (would make the most sense in my opinion because the paths aliases are relative to this path), or the workspacesroot
property.🔬 Minimal Reproduction
Create a new project containing an application and a library. Import the library in the application through TS path aliases and build it with source maps enabled. The source maps will be using absolute paths.
A simple repo can be found here: https://github.com/FERNman/angular-source-maps
Just run
ng build playground
and go to any of the generated source maps in thedist
folder. The path should be an absolute path.Workaround
For anybody else stumbling across this issue, an easy workaround until this gets fixed is to change the
root
property of the app in question in theangular.json
to the repositories' root.🌍 Your Environment
The text was updated successfully, but these errors were encountered: