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

chore(css): catch postcss config error (fix #2793) #7934

Merged
merged 1 commit into from Apr 27, 2022

Conversation

sapphi-red
Copy link
Member

Description

This PR improves error message of postcss config error.

  • before
[vite] Internal server error: Unexpected identifier
  Plugin: vite:css
  File: D:/documents/GitHub/vite/packages/playground/css/inlined.css?inline
      at Object.compileFunction (node:vm:352:18)
      at wrapSafe (node:internal/modules/cjs/loader:1032:15)
      at Module._compile (node:internal/modules/cjs/loader:1067:27)
      at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)     
      at Module.load (node:internal/modules/cjs/loader:981:32)
      at Function.Module._load (node:internal/modules/cjs/loader:822:12)
      at Module.require (node:internal/modules/cjs/loader:1005:19)
      at require (node:internal/modules/cjs/helpers:102:18)
      at Object.search (D:\documents\GitHub\vite\packages\vite\dist\node\chunks\dep-7436056c.js:21010:43)
      at resolvePostcssConfig (D:\documents\GitHub\vite\packages\vite\dist\node\chunks\dep-7436056c.js:30232:22)
  • after
[vite] Internal server error: Failed to load PostCSS config (searchPath: D:/documents/GitHub/vite/packages/playground/css): [SyntaxError] Unexpected identifier     
D:\documents\GitHub\vite\packages\playground\css\postcss.config.js:15
function testDirDep() {
         ^^^^^^^^^^
SyntaxError: Unexpected identifier
    at Object.compileFunction (node:vm:352:18)
    at wrapSafe (node:internal/modules/cjs/loader:1032:15)
    at Module._compile (node:internal/modules/cjs/loader:1067:27)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)       
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.search (D:\documents\GitHub\vite\packages\vite\dist\node\chunks\dep-55d87d37.js:21010:43)
    at resolvePostcssConfig (D:\documents\GitHub\vite\packages\vite\dist\node\chunks\dep-55d87d37.js:30232:22)
  Plugin: vite:css
  File: D:/documents/GitHub/vite/packages/playground/css/inlined.css?inline

close #2793

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 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.

@sapphi-red sapphi-red added p1-chore Doesn't change code behavior (priority) feat: css labels Apr 27, 2022
@patak-dev patak-dev merged commit 7f535ac into vitejs:main Apr 27, 2022
@sapphi-red sapphi-red deleted the chore/catch-postcss-config-error branch April 27, 2022 23:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat: css p1-chore Doesn't change code behavior (priority)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[vite] Internal server error: Unexpected string Plugin: vite:css
2 participants