vuejs / component-compiler-utils

Lower level utilities for compiling Vue single file components
319 stars 75 forks source link

Sass imports not working from node_modules #48

Open Truemedia opened 5 years ago

Truemedia commented 5 years ago

Expected behavior

I'm using SFC (single file component) hybrid where my js and sass file are linked from my vue file. The sass file itself imports files located in installed packages in node_modules/. With webpack vue plugin these easily get resolved by prefix an npm sass dependency with ~

Actual behavior

I just get these errors regardless of the file I am trying to load from node modules (example package named mymodule with file.scss sitting in root of it):

(VuePlugin plugin) Error: Error: File to import not found or unreadable: ~mymodule/file.scss.

Steps to reproduce the behavior

Create an SFC file and change the SASS to be import from external SASS file:

<style lang="scss" src="./styles.scss"></style>

Import a sass file from the top of the SFC sass file:

import '~mymodule/file.scss'

Would massively appreciate a fix for this, spent hours finding dead ends and broken code for what seems like a very common use case.