Skip to content
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

fix(css): resolve at import from dependency basedir #12796

Merged
merged 1 commit into from Apr 9, 2023

Conversation

bluwy
Copy link
Member

@bluwy bluwy commented Apr 9, 2023

Description

Fix #12795

Whenever we resolve a @import, respect basedir passed.

Previously, basedir is always the root because we append the importer with a *:

path.join(basedir, '*'),

But we check the importer existence when resolving a basedir:

if (dedupe?.includes(pkgId)) {
basedir = root
} else if (
importer &&
path.isAbsolute(importer) &&
fs.existsSync(cleanUrl(importer))
) {
basedir = path.dirname(importer)
} else {
basedir = root
}

Because the * always make this not exists, basedir is always root.

This PR fixes this.

Additional context


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the PR Title Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@bluwy bluwy added feat: css p3-minor-bug An edge case that only affects very specific usage (priority) labels Apr 9, 2023
@stackblitz
Copy link

stackblitz bot commented Apr 9, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@patak-dev patak-dev merged commit 46bdf7d into main Apr 9, 2023
12 checks passed
@patak-dev patak-dev deleted the css-fix-nested-import branch April 9, 2023 05:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat: css p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4.3.0-beta.3: postcss-import resolveId is not a function
2 participants