Rollup can't find CSS sibling files for components when running in Bazel sandbox in Stencil >= 1.15.0
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- rollup, typescript
- Domain
- build-system, tooling
Research direction
Start with the Bazel reproduction repository and compare the build behavior between Stencil 1.14.0 and 1.15.0 or newer. Then inspect src/utils/normalize-path.ts around line 143 and the Rollup path resolution involved in component styleUrls; done means the Bazel sandbox resolves each component's sibling CSS file while preserving the expected build outputs.
Written by the indexing model from the issue text.
Description
Stencil version:
@stencil/core >=1.15.0 (tested on newest releases as well 2.5.2)
I'm submitting a:
- bug report
- feature request
- support request => Please do not submit support requests here, use one of these channels: https://stencil-worldwide.herokuapp.com/ or https://forum.ionicframework.com/
Current behavior:
This change only happens when upgrading from version 1.14.0 to version 1.15.0 and is affected at every version >= 1.15.0.
When running in a Bazel sandbox, rollup is unable to resolve imports for the corresponding CSS file for a stencil component.
Say I have a component as the one pasted below, the build will work fine running directly via stencil, but then when executing through Bazel, Rollup says it can't resolve the import:
[ ERROR ] Rollup: Unresolved Import
Could not resolve './my-comp?tag=my-comp' from
./src/components/my-comp/my-comp.tsx at error
import { Component, h, State } from '@stencil/core';
@Component({
tag: "my-comp",
styleUrl: "my-comp.css",
})
export class MyComp {
render() {
return (
<Host>
<slot></slot>
</Host>
);
}
}
Expected behavior:
Rollup should find the files if they are located in the correct place.
Steps to reproduce:
I have taken the time to make an example repo exemplifying the issue and have left run instructions there. The repo illustrates that everything works with 1.14.0 but not with 1.15.0 and above
https://github.com/loudmouth/bazel-stencil
Note that simply omitting component CSS all together, but continuing to include globalStyle, the build succeeds with all expected outputs, leading me to believe this is specific only to the way CSS files set via styleUrls are resolved
Related code:
Other information:
I was reviewing the changes from 1.14.0 to 1.15.0 and was curious if possibly this issue could be due to a change in the way CSS file paths are normalized.
(If that hyperlink doesn't work, it's in the diff from 1.14.0 to 1.15.0 at src/utils/normalize-path.ts, line 143)
- Dominant language
- TypeScript
- Stars
- 13.1k
- Forks
- 855
- Avg merge
- 4h 7m
- Merged PRs (30d)
- 44
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from stenciljs/core
-
Stencil v5
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Stencil v5
Difficulty 4/5 3-5 days Newbie friendliness 55/100
-
Bug: Validated Stencil v5
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
Feature: Want this? Upvote it!
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
Feature: Want this? Upvote it!
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Similar issues
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P3
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 76/100
-
code-quality refactoring
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
vercel/react-tweet#225 ·