Skip to content

Legacy SASS loader method breaks in @next #5178

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

Closed
MarkLSky opened this issue Sep 30, 2018 · 3 comments
Closed

Legacy SASS loader method breaks in @next #5178

MarkLSky opened this issue Sep 30, 2018 · 3 comments

Comments

@MarkLSky
Copy link

I'm using a SASS component library that relies heavily on global imports, e.g:

@import "core-ui/tile";

To achieve this in react-scripts 1.x, it was a requirement to pass node_modules to the include-path:

"build-css": "node-sass-chokidar src/ -o src/ --include-path node_modules",
  "watch-css": "npm run build-css && node-sass-chokidar src/ -o src/ --watch --recursive --include-path node_modules"

From the discussion in #4903 it was decided to disallow global imports in @next, instead requiring the "~" symbol to explicitly import a module.

This is not suitable for my use case, as the library itself uses global imports to import it's own dependencies - I have no control over going in and adding "~" to every import the library uses.

The breaking issue here is that in @next it is no longer possible to use the method of loading SASS from react-scripts 1.x, as installing node-sass will trigger the sass-loader and cause a build error:

.Failed to compile.                                                    

/src/index.scss)                                                     
Module build failed:                                                  
@import "core-ui/tile";                                                                
                                                                      
^                                                                     
      File to import not found or unreadable: core-ui/tile. 

Is there any way of disabling the sass-loader in @next in order to revert the previous method?

@gaearon
Copy link
Contributor

gaearon commented Sep 30, 2018

The breaking issue here is that in @next it is no longer possible to use the method of loading SASS from react-scripts 1.x

Hmm, why would that be the case? I imagine that you can keep using the watch mode in 2.x, and import css files (not scss), like you did before. Can you provide a reproducing example?

@Timer
Copy link
Contributor

Timer commented Sep 30, 2018

What is this core-ui package? I don't see any title export.
Also, that error is stemming from your code (src/index.scss), so why can't the import be updated?

@MarkLSky
Copy link
Author

Looks like I had an .scss import left in where it should've been reverted to .css. Compiles OK with the .scss import removed.

@lock lock bot locked and limited conversation to collaborators Jan 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants