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

feat(css): warn if url rewrite has no importer #8183

Merged
merged 1 commit into from May 16, 2022

Conversation

bluwy
Copy link
Member

@bluwy bluwy commented May 15, 2022

Description

Warn if there's no importer when rewriting URLs as it causes issues like in #7186

Additional context

Example:

vite v3.0.0-alpha.0 building for production...
transforming (1) index.html
A PostCSS plugin did not pass the `from` option to `postcss.parse`. This may cause imported assets to be incorrectly transformed. If you've recently added a PostCSS plugin that raised this warning, please contact the package author to fix the issue.
✓ 11 modules transformed.
dist/index.html                  0.42 KiB
dist/assets/index.c5ab1dfe.css   0.22 KiB / gzip: 0.19 KiB
dist/assets/index.0f88313c.js    50.34 KiB / gzip: 20.31 KiB

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 Commit 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 p2-nice-to-have Not breaking anything but nice to have (priority) labels May 15, 2022
@patak-dev
Copy link
Member

I'm a little bit worried about how many plugins in the postCSS ecosystem have this issue. But I think we could merge it to get some reports from users during the beta. And we can decide before releasing v3 if we should remove this log.

@patak-dev patak-dev merged commit 0858450 into vitejs:main May 16, 2022
@bluwy bluwy deleted the css-no-from-warning branch May 16, 2022 14:58
@bluwy
Copy link
Member Author

bluwy commented May 16, 2022

Without the importer, it is breaking the build output though so users would see runtime errors when previewing. So it may be better to report it beforehand as it's something we know would happen. Don't think many modern plugins would hit this though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat: css p2-nice-to-have Not breaking anything but nice to have (priority)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants