Skip to content

REACT_APP_SASS does not generate CSS file #10

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
jbach opened this issue Oct 1, 2016 · 6 comments
Closed

REACT_APP_SASS does not generate CSS file #10

jbach opened this issue Oct 1, 2016 · 6 comments

Comments

@jbach
Copy link

jbach commented Oct 1, 2016

When REACT_APP_SASS=true, the CSS is embedded in the JS file rather than output as a separate CSS file. I guess ExtractTextPlugin.extract is missing for the Sass loader?

@kitze
Copy link
Owner

kitze commented Oct 2, 2016

This should be only happening in development mode, in production mode when using npm run build the compiled css should be in an extra file because ExtractTextPlugin.extract is configured.

@jbach
Copy link
Author

jbach commented Oct 2, 2016

I’ve added a reduced testcase to https://github.com/jbach/custom-react-scripts-sass. Try running npm run build, the css will not be extracted. Am I doing something wrong? Maybe I’m confused, but looking at config/customizers.js, I don’t see ExtractTextPlugin.extract.

When I manually change the sass-loader in config/customizers.jsto

'SASS': {
    toArray: 'loaders',
    get: function () {
      return {
        test: /\.scss$/,
        loader: ExtractTextPlugin.extract('style', "css!postcss!sass")
      }
    }
  }

a separate CSS file is built.

@kitze
Copy link
Owner

kitze commented Oct 3, 2016

Just released 0.0.14 with a better fix for this. Now each customizer has a getDev and getProd functions. Should be ok now.

@jbach
Copy link
Author

jbach commented Oct 3, 2016

Thank you for the fix, but can you confirm 0.0.14 is installable via npm? Installation via npm i custom-react-scripts fails for me with Node 6.6.0 / npm 3.10.3. See my full npm-debug.log

npm ERR! Path must be a string. Received undefined

@kitze
Copy link
Owner

kitze commented Oct 3, 2016

Yes. I got the same error with Node v6.6.0. I also see other people [have this issue]with different npm packages (webpack/webpack#2463) but I have no idea why.

Installing the scripts with Node v.6.2.0 worked completely fine for me. Please try it and let me know.

@jbach
Copy link
Author

jbach commented Oct 3, 2016

I’ll close this issue. The nonrelated install bug is described in #13

@jbach jbach closed this as completed Oct 3, 2016
@jbach jbach mentioned this issue Oct 3, 2016
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

2 participants