Skip to content

fix(@angular-devkit/build-angular): avoid undefined module path for Sass imports in esbuild - #24569

Merged
angular-robot[bot] merged 1 commit into
angular:mainfrom
clydin:esbuild/sass-module-deep-import
Jan 19, 2023
Merged

angular-robot[bot] merged 1 commit into
angular:mainfrom
clydin:esbuild/sass-module-deep-import

Conversation

@clydin

@clydin clydin commented Jan 18, 2023

Copy link
Copy Markdown
Member

When using Sass with the experimental esbuild-based browser application builder, bare imports without a path segment that were available via included paths but also happen to be a node module could cause an exception. An example of such an import would be @import "globals";. The deep import node module logic would previously attempt to join an undefined path segment to the resolved path for the globals package which would raise a argument type exception. This case has now been fixed by only joining if there is actually a path segment present such as @import "globals/x". With this fix in place, the node module case can then continue and if no stylesheet is found, the include paths will then be searched.

…ass imports in esbuild

When using Sass with the experimental esbuild-based browser application builder, bare imports
without a path segment that were available via included paths but also happen to be a node module
could cause an exception. An example of such an import would be `@import "globals";`. The deep
import node module logic would previously attempt to join an undefined path segment to the resolved
path for the `globals` package which would raise a argument type exception. This case has now been
fixed by only joining if there is actually a path segment present such as `@import "globals/x"`.
With this fix in place, the node module case can then continue and if no stylesheet is found, the
include paths will then be searched.
@clydin clydin added the target: patch This PR is targeted for the next patch release label Jan 18, 2023
@clydin clydin linked an issue Jan 18, 2023 that may be closed by this pull request
1 task
@alan-agius4 alan-agius4 added the action: merge The PR is ready for merge by the caretaker label Jan 19, 2023
@angular-robot
angular-robot Bot merged commit d19f260 into angular:main Jan 19, 2023
@clydin
clydin deleted the esbuild/sass-module-deep-import branch January 19, 2023 22:55
@angular-automatic-lock-bot

Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Feb 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Angular 15 fails with scss errors when building with browser:es-build

2 participants