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

Bootstrap's sass is not working with new r2.0.0-next.66cc7a90 (with opt-in sass) #4363

Closed
woile opened this issue Apr 25, 2018 · 11 comments
Closed
Milestone

Comments

@woile
Copy link

woile commented Apr 25, 2018

Is this a bug report?

Doubt it, but it might be interesting to know, due to the fact that bootstrap is recommended in the README, and bootstrap itself recommends using sass for its full potential

Relates to #3815

Environment

  1. node -v: 8.9.1
  2. yarn --version (if you use Yarn): 1.6.0
  3. npm ls react-scripts (if you haven’t ejected): r2.0.0-next.66cc7a90
  4. Operating system: debian sid amd64

Steps to Reproduce

  1. npx create-react-app myapp --scripts-version react-scripts@2.0.0-next.66cc7a90
  2. rename index.css to index.scss
  3. update index.js to point to index.scss
  4. yarn add bootstrap
  5. open index.scss and add at the bottom @import "~bootstrap/scss/bootstrap.scss";
  6. yarn && yarn start

Expected Behavior

No error is shown.

Actual Behavior

This error appears:

./src/index.scss
Module build failed: 
module.exports = require('./lib/node-progress');
^
      Invalid CSS after "m": expected 1 selector or at-rule, was "module.exports = re"
      in bla/bla/bla/node_modules/progress/index.js (line 1, column 1)

More info

According to bootstrap:

For Bootstrap to compile, make sure you install and use the required loaders: sass-loader, postcss-loader with Autoprefixer

I think those loaders are missing, does anyone know if there's an easy way to add them without ejecting?

I hope to be helpful,

Thanks to everyone!

@miraage
Copy link

miraage commented Apr 26, 2018

Same here.
node 8.9.1
npm 6.0.0
react-scripts 2.0.0-next.66cc7a90
osx 10.13.4

@easadler
Copy link

easadler commented Apr 26, 2018

I'm getting the same error. Deleting @import progress from node_modules/bootstrap/scss/bootstrap.scss fixed the problem. The file being imported is javascript, but I think is being read as CSS.

Thanks for supporting sass and looking forward to a solution!

@Timer Timer added this to the 2.0.0 milestone Apr 26, 2018
@phahn
Copy link

phahn commented Apr 26, 2018

I think this is related to webpack-contrib/sass-loader#556

For me it happenend when I had a npm package with the same name as a sass file I was trying to import from node_modules.

@miraage
Copy link

miraage commented Apr 27, 2018

AFAIK sass-loader@7.0.1 solves this problem.

@iansu
Copy link
Contributor

iansu commented Apr 27, 2018

Does someone want to submit a PR to update sass-loader? It would be nice to add a test for this case as well.

@miraage
Copy link

miraage commented Apr 27, 2018

Just tested cra@2-beta + eject + sass-loader@7.0.1
Problem gone

@gaearon
Copy link
Contributor

gaearon commented Apr 27, 2018

Before we close this, worth keeping an eye on webpack-contrib/sass-loader#556 (comment).

iansu pushed a commit that referenced this issue Apr 28, 2018
* Update sass-loader (#4363)

* Added bootstrap scss test (#4376)
@iansu
Copy link
Contributor

iansu commented Apr 28, 2018

I merged the PR updating sass-loader to 7.0.1 but I'll leave this issue open for the time being.

@hermanho
Copy link

hermanho commented Jun 8, 2018

Could the fixed alpha version be deployed to npm?

@seif1000
Copy link

seif1000 commented Aug 7, 2018

add ``import 'bootstrap/dist/js/bootstrap.bundle.min'; to your route index.js

@Timer Timer modified the milestones: 2.0.x, 2.x, 2.0.0 Sep 26, 2018
@Timer
Copy link
Contributor

Timer commented Sep 27, 2018

This is working in v2 beta. We don't use the options linked in above issue -- not sure this is worth keeping open unless someone can formulate a better proposal on what we need to keep an eye out for or do.

@Timer Timer closed this as completed Sep 27, 2018
zmitry pushed a commit to zmitry/create-react-app that referenced this issue Sep 30, 2018
* Update sass-loader (facebook#4363)

* Added bootstrap scss test (facebook#4376)
@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.
Projects
None yet
Development

No branches or pull requests

9 participants