0
votes

I am trying to add bootstrap-css-only to react-boilerplate project but I get error. If I remove the @import line the, it works fine

global-styles.scss

@import '~bootstrap-css-only/css/bootstrap';
@import 'assets/styles/Antd/antd.cleanui';
@import 'assets/styles/CleanUI/cleanui';
@import 'assets/styles/Bootstrap/bootstrap.cleanui';
@import 'assets/styles/Chartist/chartist.cleanui';
@import 'assets/styles/Nprogress/nprogress.cleanui';
@import 'assets/styles/Rcdrawer/rcdrawer.cleanui';
@import '~c3/c3.min.css';

webpack.base.js

module: {
    noParse: /moment\.js/,
    rules: [
      {
        test: /\.js$/, // Transform all .js files required somewhere with Babel
        exclude: /node_modules/,
        use: {
          loader: 'babel-loader',
          query: {
            plugins: [
              [
                'import',
                {
                  libraryName: 'antd',
                  style: 'css',
                },
              ],
            ],
          },
        },
      },
      {
        test: /\.(eot|otf|ttf|woff|woff2)$/,
        use: 'file-loader',
        exclude: /\.(less|scss|css)$/,
      },
      {
        test: /\.(less|scss|css)$/,
        use: [
          'style-loader',
          {
            loader: 'css-loader',
            options: {
              importLoaders: 1,
            },
          },
          'less-loader',
          'sass-loader',
        ],
      },
      {
        test: /\.svg$/,
        use: [
          {
            loader: 'svg-url-loader',
            options: {
              // Inline files smaller than 10 kB
              limit: 10 * 1024,
              noquotes: true,
            },
          },
        ],
      },
      {
        test: /\.(jpg|png|gif)$/,
        use: [
          {
            loader: 'url-loader',
            options: {
              // Inline files smaller than 10 kB
              limit: 10 * 1024,
            },
          },
          {
            loader: 'image-webpack-loader',
            options: {
              mozjpeg: {
                enabled: false,
                // NOTE: mozjpeg is disabled as it causes errors in some Linux environments
                // Try enabling it in your environment by switching the config to:
                // enabled: true,
                // progressive: true,
              },
              gifsicle: {
                interlaced: false,
              },
              optipng: {
                optimizationLevel: 7,
              },
              pngquant: {
                quality: '65-90',
                speed: 4,
              },
            },
          },
        ],
      },
      {
        test: /\.html$/,
        use: 'html-loader',
      },
      {
        test: /\.(mp4|webm)$/,
        use: {
          loader: 'url-loader',
          options: {
            limit: 10000,
          },
        },
      },
    ],
  },

Cannot read property 'denominator' of undefined in C:\Recp\node_modules\bootstrap-css-only\css\bootstrap.min.css (line 6, column 26583) @ ./app/global-styles.scss (./node_modules/css-loader??ref--6-1!./node_modules/less-loader/dist/cjs.js!./node_modules/sass-lo ader/lib/loader.js!./app/global-styles.scss) 3:10-149 @ ./app/global-styles.scss @ ./app/app.js @ multi ./node_modules/react-app-polyfill/ie11.js webpack-hot-middleware/client?reload=true ./app/app.js

1

1 Answers

0
votes

Remove the .css extebtion and the scss compiler will inline the css file. Right now it is trying to load the file through another request.