Skip to content

Conversation

@brandonroberts
Copy link
Member

PR Checklist

Closes #2023

What is the new behavior?

  • Relative styles (src) are resolved from the workspace root + project root + styles path.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

[optional] What gif best describes this PR or how it makes you feel?

@netlify
Copy link

netlify bot commented Dec 19, 2025

Deploy Preview for analog-docs ready!

Name Link
🔨 Latest commit 120e7e3
🔍 Latest deploy log https://app.netlify.com/projects/analog-docs/deploys/694597386efe6b0007774ad9
😎 Deploy Preview https://deploy-preview-2025--analog-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Dec 19, 2025

Deploy Preview for analog-blog ready!

Name Link
🔨 Latest commit 120e7e3
🔍 Latest deploy log https://app.netlify.com/projects/analog-blog/deploys/69459738a4f789000889802a
😎 Deploy Preview https://deploy-preview-2025--analog-blog.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Dec 19, 2025

Deploy Preview for analog-app ready!

Name Link
🔨 Latest commit 120e7e3
🔍 Latest deploy log https://app.netlify.com/projects/analog-app/deploys/69459738f3b74a00081af1e4
😎 Deploy Preview https://deploy-preview-2025--analog-app.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@brandonroberts brandonroberts merged commit 33e7b6c into beta Dec 19, 2025
18 checks passed
@brandonroberts brandonroberts deleted the fix-storybook-preset-resolve-styles branch December 19, 2025 18:26
Comment on lines +152 to +163
.map((extraImport) => {
if (
extraImport.startsWith('.') ||
extraImport.startsWith('src')
) {
// relative to root
return `import '${resolve(options.angularBuilderContext.workspaceRoot, projectConfig.root, extraImport)}';`;
}
// absolute import
return `import '${extraImport}';`;
})
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @brandonroberts, actually there is no need in extra conditions here as path.resolve('/abosulte_path_to_project', '/absolute_path_to_style') will resolve to /absolute_path_to_style so all this code code can be replace with a simple return import '${resolve(options.angularBuilderContext.workspaceRoot, projectConfig.root, extraImport)}'; and it will cover all the cases.

Copy link

@th0r th0r Dec 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example in our project all the code is located not in the src directory, so specifying styles: ['path/to/our/src/global.scss'] still won't work. I understand that we could start the path with a dot, but why introduce these confusing rules if they can we avoided. 🤷‍♂️

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Always use the resolved path won't cover importing styles from node_modules for example. You should be able to use a relative path to import from the correct path if its outside the project root.

Copy link

@th0r th0r Dec 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, why? If project root is /home/user/project then path.resolve('/home/user/project', '../node_modules') will be resolved to /home/user/node_modules. Isn't it what we want?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Nx workspaces, paths are resolved from the root, so we don't want to always resolve from the project root

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Storybook global styles are not resolved correctly from project root

3 participants