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

css @import "~font-awesome/.." is broken in RC #1453

Closed
appinteractive opened this issue Aug 23, 2017 · 12 comments
Closed

css @import "~font-awesome/.." is broken in RC #1453

appinteractive opened this issue Aug 23, 2017 · 12 comments

Comments

@appinteractive
Copy link

appinteractive commented Aug 23, 2017

After the update to RC I cant Import Node Modules anymore the standard way with @import "~font-awesome/... but have to remove it @import "font-awesome/.... But this behavior breaks all other stuff that is relying on the standard way. In our case we use vue-styleguidist which than can't resolve the scss imports anymore (uses it's own webpack config).

I tried to fix that with the webpack alias but can't find any way that satisfies both.

This question is available on Nuxt.js community (#c1293)
@appinteractive appinteractive changed the title @import "~font-awesome/.." is broken css @import "~font-awesome/.." is broken in RC Aug 23, 2017
@Atinux
Copy link
Member

Atinux commented Aug 23, 2017

Hi @appinteractive

This is related to #1435, sass-loader depends on css-loader and for rc5 & rc6, we used ~ as root so @import "~font-awesome/... was resolved from srcDir, will be fixed in new release.

@appinteractive
Copy link
Author

Thanks Sébastien, saw that issue and was already wondering if it's related.

@Atinux
Copy link
Member

Atinux commented Aug 29, 2017

Should work with rc7 even if the PR has not been merged, please make sure to rm -rf node_modules/ && npm install to be sure that it's a clean install.

@appinteractive
Copy link
Author

@Atinux thats not fixing my issue:
Module build failed: Error: Failed to find '~font-awesome/css/font-awesome.min.css'

But I guess I have to wait for the Fix webpack-contrib/css-loader#597

@Atinux Atinux reopened this Aug 29, 2017
@pi0
Copy link
Member

pi0 commented Aug 30, 2017

Should be finally fixed with rc8 🎉

https://github.com/nuxt/nuxt.js/releases/tag/v1.0.0-rc8

@pi0 pi0 closed this as completed Aug 30, 2017
@appinteractive
Copy link
Author

appinteractive commented Sep 4, 2017

Still that issue exists! When you try to import @import "~font-awesome/... you always get errors:

Module build failed: Error: Failed to find '~font-awesome/css/font-awesome.min.css'
    in [ 
        /Users/Greg/Projekte/HumanConnection/hc-frontend-nuxt/assets/styles,
        /Users/Greg/Projekte/HumanConnection/hc-frontend-nuxt,
        /Users/Greg/Projekte/HumanConnection/hc-frontend-nuxt,
        /Users/Greg/Projekte/HumanConnection/hc-frontend-nuxt/node_modules
    ]
    at /Users/Greg/Projekte/HumanConnection/hc-frontend-nuxt/node_modules/postcss-import/lib/resolve-id.js:48:11
    at <anonymous>

 @ ./assets/styles/main.scss 4:14-199 13:3-17:5 14:22-207
 @ ./node_modules/babel-loader/lib?{"babelrc":false,"cacheDirectory":true,"presets":["/Users/Greg/Projekte/HumanConnection/hc-frontend-nuxt/node_modules/babel-preset-vue-app/dist/index.common.js"]}!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./.nuxt/App.vue
 @ ./.nuxt/App.vue
 @ ./.nuxt/index.js
 @ ./.nuxt/client.js
 @ multi webpack-hot-middleware/client?name=client&reload=true&timeout=3000&path=/__webpack_hmr ./.nuxt/client.js

@pi0 pi0 reopened this Sep 4, 2017
@uptownhr
Copy link

uptownhr commented Sep 7, 2017

i can also confirm this issue with trying to load flatpickr.min.css

@import '~flatpickr/dist/flatpickr.min.css'

@uptownhr
Copy link

uptownhr commented Sep 7, 2017

@import '~/node_modules/flatpickr/dist/flatpickr.min.css';

also not working. what are the rules for ~ in style area?

@clarkdo
Copy link
Member

clarkdo commented Jan 10, 2018

@uptownhr @appinteractive Can you have a try on 1.0.0 ? If issue still existed, pls provide a repo.

@rafaesc
Copy link

rafaesc commented Jan 10, 2018

Hi @abalabahaha,

there is an example with vue-styleguidist and nuxtjs,
https://github.com/vue-styleguidist/vue-styleguidist/tree/master/examples/nuxtjs

I hope it helps you.

@clarkdo
Copy link
Member

clarkdo commented Jan 17, 2018

By default postcss-import is enabled for inlining @import rules content, so you should use font-awesome/... because postcss-import won't resolve ~, or you can disable postcss-import in build.postcss, then you can use ~/font-awesome/....

@lock
Copy link

lock bot commented Nov 3, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Nov 3, 2018
@danielroe danielroe added the 2.x label Jan 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants