-
-
Notifications
You must be signed in to change notification settings - Fork 7.2k
Closed
Labels
Description
- Read the docs.
- 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.
- This is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
Describe the bug
Similar to #2455, when importing SCSS into a JS file, with the ?url
flag, the import will fail.
A related, but apparently different bug, is that if ?url
is used with a CSS file, it evaluates to a string like export default "/src/style.css"
. This may deserve a separate issue.
Reproduction
This can be reproduced with:
yarn create @vitejs/app --template vue vite-sample
; cdyarn add sass
- Create
src/style.scss
- Add an import to
App.vue
import data from "./style.scss?url" console.log(data)
Error in console
[plugin:vite:css] expected "{".
╷
1 │ export default "/src/style.scss"
│ ^
╵
src/style.scss 1:33 root stylesheet
/home/jonathan/src/git.ec2software.com/jonathan/vite-sample/src/style.scss:1:33
at Object._newRenderError (/home/jonathan/src/git.ec2software.com/jonathan/vite-sample/node_modules/sass/sass.dart.js:13537:19)
at Object._wrapException (/home/jonathan/src/git.ec2software.com/jonathan/vite-sample/node_modules/sass/sass.dart.js:13374:16)
at _render_closure1.call$2 (/home/jonathan/src/git.ec2software.com/jonathan/vite-sample/node_modules/sass/sass.dart.js:80373:21)
at _RootZone.runBinary$3$3 (/home/jonathan/src/git.ec2software.com/jonathan/vite-sample/node_modules/sass/sass.dart.js:27269:18)
at _FutureListener.handleError$1 (/home/jonathan/src/git.ec2software.com/jonathan/vite-sample/node_modules/sass/sass.dart.js:25797:19)
at _Future__propagateToListeners_handleError.call$0 (/home/jonathan/src/git.ec2software.com/jonathan/vite-sample/node_modules/sass/sass.dart.js:26094:49)
at Object._Future__propagateToListeners (/home/jonathan/src/git.ec2software.com/jonathan/vite-sample/node_modules/sass/sass.dart.js:4543:77)
at _Future._completeError$2 (/home/jonathan/src/git.ec2software.com/jonathan/vite-sample/node_modules/sass/sass.dart.js:25927:9)
at _AsyncAwaitCompleter.completeError$2 (/home/jonathan/src/git.ec2software.com/jonathan/vite-sample/node_modules/sass/sass.dart.js:25270:12)
at Object._asyncRethrow (/home/jonathan/src/git.ec2software.com/jonathan/vite-sample/node_modules/sass/sass.dart.js:4292:17
Click outside or fix the code to dismiss.
You can also disable this overlay with hmr: { overlay: false } in vite.config.js.
System Info
vite
version: 2.1.0- Operating System: Arch Linux
- Node version: v15.10.0
- Package manager (npm/yarn/pnpm) and version: yarn
Logs (Optional if provided reproduction)
- Run
vite
orvite build
with the--debug
flag. - Provide the error log here.
mijamo, C-H-F, tarnishablec, GeKorm, ernestoalejo and 23 more
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Has plan