-
Notifications
You must be signed in to change notification settings - Fork 11.9k
fix(@angular/build): resolve PostCSS plugins relative to config file #31119
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
Conversation
packages/angular/build/src/tools/esbuild/stylesheets/stylesheet-plugin-factory.ts
Outdated
Show resolved
Hide resolved
4b0118d
to
b381df8
Compare
Previously, PostCSS plugins were resolved from the location of `@angular/build`. This caused issues when the PostCSS configuration file was located in a subdirectory and used plugins not hoisted to the root `node_modules`, as plugins would not be found. This change updates the PostCSS configuration loading to resolve plugins relative to the directory containing the PostCSS configuration file. This ensures that plugins are correctly located regardless of the configuration files location.
b381df8
to
aaa6665
Compare
for (const [pluginName, pluginOptions] of options.postcssConfiguration.plugins) { | ||
const { default: plugin } = await import(pluginName); | ||
|
||
const postCssPluginRequire = createRequire(dirname(configPath) + '/'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alan-agius4 this change brakes importing of plugins that are ES modules as in this case the plugin
below won't be a function, but an {default: <function>, __esModule: true}
object and it won't pass a check below.
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. |
Previously, PostCSS plugins were resolved from the location of
@angular/build
. This caused issues when the PostCSS configuration file was located in a subdirectory and used plugins not hoisted to the rootnode_modules
, as plugins would not be found.This change updates the PostCSS configuration loading to resolve plugins relative to the directory containing the PostCSS configuration file. This ensures that plugins are correctly located regardless of the configuration files location.