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

File to import not found or unreadable: ~typeface-lato. #1296

Closed
JounQin opened this issue May 11, 2018 · 3 comments
Closed

File to import not found or unreadable: ~typeface-lato. #1296

JounQin opened this issue May 11, 2018 · 3 comments

Comments

@JounQin
Copy link

JounQin commented May 11, 2018

Version

15.0.0

Reproduction link

https://github.com/JounQin/blog/blob/master/src/views/App.vue#L213

Steps to reproduce

change this line to @import '~typeface-lato'; and run npm run build:vue:client

What is expected?

No error thrown

What is actually happening?


    ERROR in ./src/views/App.vue?vue&type=style&index=0&lang=scss (./node_modules/css-loader??ref--4-oneOf-1-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/lib??ref--4-oneOf-1-2!./node_modules/resolve-url-loader!./node_modules/sass-loader/lib/loader.js??ref--9-oneOf-1-4!./node_modules/sass-resources-loader/lib/loader.js??ref--9-oneOf-1-5!./node_modules/vue-loader/lib??vue-loader-options!./src/views/App.vue?vue&type=style&index=0&lang=scss)
    Module build failed:
    undefined
    ^
          File to import not found or unreadable: ~typeface-lato.
          in /local/GitHub/blog/src/views/App.vue (line 1277, column 1)

It is weird because there is no error thrown on development. And I was thinking maybe it was a bug of sass-loader, but when I change the codes like following it will also work:

<style src="typeface-lato"></style>

typeface-lato is a package which main field in package.json is a .css file.

@yiqianglin
Copy link

same problem

@LinusBorg
Copy link
Member

I think sass-loader skips imports of .css files, so thze next loader (postcss-loader/css-loader) handles them, and I think those don't use the ~ tilde character for node_modules packages.

@JounQin
Copy link
Author

JounQin commented May 23, 2018

OK, I'm using like following now and ~ is still needed for node_modules packages in .css/.scss @import:

<style>
@import '~font-awesome/css/font-awesome.css';
@import '~github-markdown-css';
@import '~typeface-lato';
</style>

@JounQin JounQin closed this as completed May 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants