Repository navigation
fix(css): @import with .css in node_modules importing a different package failed to resolve - #15000
Conversation
sapphi-red
left a comment
There was a problem hiding this comment.
I haven't tried yet, but IIUC this rebaseUrl function only rewrites @import with css extension. The issue is about @import with less extension. Does this work?
Also would you add a test?
|
Hi @sapphi-red, I have tested this fix by linking vite against the failing case https://stackblitz.com/edit/vite-sass-transitive-import?file=src%2Fstyle.scss in #12227 and now the file can be correctly resolved. The less version should work the same. I have tried to write a test case for that, but it seems the issue only happens for npm instead of pnpm package manager. I can't make the test case fail without this fix. |
|
I see. It seems #9681 and #12227 is caused by a different reason. I mistakenly said #12227 is a duplicate.
I guess it would fail if you use |
|
Hi @sapphi-red a test cases is added with your method to use file instead of link. Can we merge this soon? Thanks! There are some flaky tests on node-20, macos-latest however it passes on my development mac |
…onflict markers, and pin skill contracts (#94) Fixes two pr-kit skill defects from the 2026-09-17 audit and adds pr-kit's first tests. Every command claim below was measured in scratch repos or against live PRs. ## Changes - **`get-pr-comments` keeps open threads (cpl-0ye).** It skipped every outdated thread, but outdated means only that a later push changed the code the comment was left on. Outdated but unresolved threads now appear under **Possibly stale — verify**, located by `originalLine` (`line` is null on them — measured on vitejs/vite#15000, #11228, #2432 and cli/cli#14475). - **`get-pr-comments` pages for real (cpl-0ye).** The thread query declares `$endCursor`, which `gh api --paginate` requires; `--slurp` returns every page. A `node(id)` follow-up re-reads a thread with more than 50 comments. Measured with `first:2`: 5 pages, 9 threads; `--paginate` follows the thread cursor even when a nested comments page has more. - **`fix-merge-conflicts` checks the whole tree (cpl-r73).** `git diff --cached --check` missed a conflicted file left unstaged and failed on trailing whitespace. It is replaced by `git diff --name-only --diff-filter=U` plus two `git grep` marker searches with `-- ':/'`: one over the working tree, one over the index (`--cached`). The pattern covers diff3 `|||||||` and markers longer than 7; exit 128 is a failed search. - **`fix-merge-conflicts` states that a rebase swaps sides (cpl-r73).** A table and sentence: during `git rebase`, `ours` is the upstream and `theirs` is your commit; check `git status` for `rebase in progress` first. - **`fix-merge-conflicts` handles conflicts that leave no markers.** Binaries, symlinks, and paths one side deleted or both sides renamed pass every marker check once staged, with `git add` silently keeping the working-tree copy (the upstream, during a rebase). The skill now has the agent keep a side or `git rm` the path explicitly and report it. Submodule conflicts are out of scope: `git checkout --ours/--theirs` exits 0 on them and changes nothing. - **pr-kit prose-anchor tests (cpl-k3s).** `plugins/pr-kit/tests/skill-contracts.spec.ts`, 16 vitest tests, pinning the fixes above plus the earlier audit's contracts: the `make-pr-easy-to-review` tree guard, the `fix-ci` round cap, no skill invoking a model-disabled skill, every gh field a skill fills in being fetched, and the README's `gh` requirement matching the skills that call `gh`. Each of 42 literal mutations fails its own test. - **Release note:** `.changeset/pr-kit-audit-findings.md` (pr-kit patch). cpl-121 (README `gh` claim) was already fixed on main by #54 and is closed with no code change. ## Review `/review-cycle:review` converged in 5 iterations (Codex, code-reviewer, pr-test-analyzer, silent-failure-hunter; then spec conformance and a maintainability audit). Spec conformance found no missing or wrong requirements. ## Follow-ups - cpl-yxo — deferred anchor and marker-check gaps (CRLF `=======`, slashless skill references, `True` in frontmatter, a submodule cue, nine test-tightening suggestions). - cpl-crj — share anchor helpers across plugins and run the model-disabled-reference check repo-wide (3 unchecked references in review-cycle today). ## Test plan - `pnpm test` — 727 passed - `pnpm lint`, `pnpm format:check`, markdownlint — clean - `claude plugin validate ./plugins/pr-kit --strict` — passed - `pnpm exec oakum check --strict` — exit 0
Description
fixes #12227
refs #9681
Additional context
The cause of the bug is when performing sass style preprocessing, it's trying to rewrite the @import lines in the code using sass render with internalImporter.
The internalImporter resolve the url and then tries to perform a rebase of the url. The rebaseUrls is not correctly performing rebase if we try to perform another import from a different package.
So instead of calling path.resolve, we have to try the corresponding resolver first with id and importer.
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123).