Skip to content

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

Closed

Description

@woile

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!

Activity

  1. miraage commented on Apr 26, 2018

    @miraage

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

  2. easadler commented on Apr 26, 2018

    @easadler

    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!

  3. added this to the milestone on Apr 26, 2018
  4. phahn commented on Apr 26, 2018

    @phahn

    I think this is related to webpack/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.

  5. miraage commented on Apr 27, 2018

    @miraage

    AFAIK sass-loader@7.0.1 solves this problem.

  6. iansu commented on Apr 27, 2018

    @iansu
    Contributor

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

  7. miraage commented on Apr 27, 2018

    @miraage

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

  8. gaearon commented on Apr 27, 2018

    @gaearon
    Contributor

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

  9. added a commit that references this issue on Apr 28, 2018
  10. iansu commented on Apr 28, 2018

    @iansu
    Contributor

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

  11. hermanho commented on Jun 8, 2018

    @hermanho

    Could the fixed alpha version be deployed to npm?

  12. seif1000 commented on Aug 7, 2018

    @seif1000

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

  13. modified the milestones: 2.0.x, 2.x on Sep 26, 2018
  14. Timer commented on Sep 27, 2018

    @Timer
    Contributor

    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.

  15. added a commit that references this issue on Sep 30, 2018
  16. locked and limited conversation to collaborators on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions