-
Notifications
You must be signed in to change notification settings - Fork 74
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
Using the global variable problem in Vite #267
Comments
Using "additionalData" to define your global variables may solve your problem. |
I know, the above is my result after using additionalData, it is showing error, but it does not affect the compilation, I want to solve this problem |
I'm experiencing the same issue. I can add arbitrary classes to It also breaks the plugin for everything, not just files that make use of these globals, which makes me think it's not able to handle the relative imports unlike Vite. As a temporary workaround, you can use |
I've found a fix for the problem, and a potential improvement in either the code or the docs (or both!). This line sets up the alias imports:
It needs the presence of The easy fix is just to add the following to your tsconfig: "compilerOptions": {
"paths": {}
} This then allows the alias importer to resolve relative to your tsconfig, as well as relative to the file it is resolving. |
Also, if anyone can provide a repro for the initial issue, that would be greatly appreciated. |
Describe the bug
Import the global variable in Vite, when the variable is used in another file, the prompt invalidates
To Reproduce
Steps to reproduce the behavior:
3.Yes, it's wrong
Expected behavior
It should make no errors and parse the scss file correctly
Screenshots
global variable file(global variable are defined )
head.scss(using global variable)
After importing, using it throws an error
I put the variable in the head file and it worked fine
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: