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

Regression: can not get css text in the plugin #3610

Closed
6 tasks done
anncwb opened this issue Jun 1, 2021 · 4 comments
Closed
6 tasks done

Regression: can not get css text in the plugin #3610

anncwb opened this issue Jun 1, 2021 · 4 comments
Labels
regression The issue only appears after a new release

Comments

@anncwb
Copy link
Contributor

anncwb commented Jun 1, 2021

Describe the bug

After upgrading to 2.3.4, the custom plugin can’t get the css value.

This is caused by #3402, I am not sure why the output is changed to an empty string, which is useful for some specific css processing plugins.
For example, a plugin that extracts the color of certain variables in the entire css

Reproduction

  async transform(code, id) {
    // I will not be able to get the code here
  }     

System Info

Output of npx envinfo --system --npmPackages vite,@vitejs/plugin-vue --binaries --browsers:

  System:
    OS: macOS 10.15.4
    CPU: (8) x64 Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz
    Memory: 60.26 MB / 16.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 14.15.3 - ~/.nvm/versions/node/v14.15.3/bin/node
    Yarn: 1.21.1 - /usr/local/bin/yarn
    npm: 6.14.9 - ~/.nvm/versions/node/v14.15.3/bin/npm
  Browsers:
    Chrome: 91.0.4472.77
    Firefox: 86.0
    Safari: 13.1
  npmPackages:
    vite: ^2.1.5 => 2.1.5 

Used package manager:

Logs


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

  • Read the Contributing Guidelines.
  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Provide a description in this issue that describes the bug.
  • Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/vue-next instead.
  • Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
@anncwb anncwb added pending triage regression The issue only appears after a new release and removed pending triage labels Jun 1, 2021
dominikg added a commit to dominikg/vite that referenced this issue Jun 1, 2021
@patak-dev
Copy link
Member

@anncwb #3402 was reverted by #3630, and released in vite@2.3.6

@ferdinando-ferreira
Copy link
Contributor

@patak-js , @anncwb : I see based on #2148 (comment) and #2148 (comment) that this was already in discussion at #2148.

Should the solution for both problems be followed up in that ticket?

@patak-dev
Copy link
Member

patak-dev commented Jun 2, 2021

@ferdinando-ferreira I was planning to comment in #3402 about this. As you said, the solution should be one of the possibilities described in #2148 so users that want to access the CSS string to handle it themselves can still do it (and in that case, it will not be auto-applied). The last time we discussed this with Evan, there was still uncertainty about the API though. The API should also take into account proposals that may allow us to do this natively on the web (although it may end up looking similar to https://github.com/tc39/proposal-import-assertions). If you have a proposal to share, you could do it in that issue or you could draft a PR implementing it forking the one that was reverted. We can then discuss these options again with Evan.
Thanks for the PRs you worked out and discussions you have been part of by the way!

@github-actions
Copy link

This issue has been locked since it has been closed for more than 14 days.

If you have found a concrete bug or regression related to it, please open a new bug report with a reproduction against the latest Vite version. If you have any other comments you should join the chat at Vite Land or create a new discussion.

@github-actions github-actions bot locked and limited conversation to collaborators Jul 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
regression The issue only appears after a new release
Projects
None yet
Development

No branches or pull requests

3 participants