-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
Cannot import CSS from node_modules using "~" pattern #382
Comments
What should |
@MarvinRudolph Updated the description to make it clearer, basically |
Unsubscribe
… On 11-Jun-2020, at 4:55 AM, Ashish Shubham ***@***.***> wrote:
Do NOT ignore this template or your issue will have a very high chance to be closed without comment.
Describe the bug
@import ***@***.***/path/file.scss';
// styles here
Throws error:
Error: Can't find stylesheet to import.
This seems related to #291 . But the problem here is when a ~ is prefixed.
System Info
required vite version: 0.20.7
required Operating System: OSX
required Node version: 12.11.0
Logs (Optional if provided reproduction)
Error: Can't find stylesheet to import.
╷
1 │ @import ***@***.***/radiant-styles/_base.scss';
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
╵
../js/ts-packages/radiant-react/widgets/alert/muted/muted-alert.scss 1:9 root stylesheet
at Object._newRenderError (/Users/ashish.shubham/thoughtspot/blink-v2/node_modules/sass/sass.dart.js:14477:19)
at Object._wrapException (/Users/ashish.shubham/thoughtspot/blink-v2/node_modules/sass/sass.dart.js:14324:16)
at StaticClosure._renderSync (/Users/ashish.shubham/thoughtspot/blink-v2/node_modules/sass/sass.dart.js:14299:18)
at Object.Primitives_applyFunction (/Users/ashish.shubham/thoughtspot/blink-v2/node_modules/sass/sass.dart
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
@AXWELL911 please unwatch this repo, don’t spam everyone with unsubscribe emails. |
~ is a convention alias configured in vue-cli. There’s no such thing in Vite. |
Hi, You can use |
I found this issue as I made the same mistake. In vite it is simply |
Is there a way to set it up so that it continues to work with vue-cli but also works with vite? I tried adding an alias in vite.config.js but no luck so far |
It would be nice to have a way to configure this in vite to make migration from vue-cli projects easier. In the meantime, an ugly workaround is to define aliases for each library resolve: {
alias: {
'~bulma': 'bulma',
'~buefy': 'buefy',
}
} |
Add this config to resolve: {
alias: [
{
find: /^~.+/,
replacement: (val) => {
return val.replace(/^~/, "");
},
},
],
}, |
@xiaobebe alias's replacement takes string rather than function. therefore it occurs type error. |
I use the following config for an Electron Project I use. It seems to work perfectly:
|
Describe the bug
Throws error:
Error: Can't find stylesheet to import.
This seems related to #291 . But the problem here is when a
~
is prefixed.System Info
vite
version: 0.20.7Logs (Optional if provided reproduction)
The text was updated successfully, but these errors were encountered: