insin / nwb

A toolkit for React, Preact, Inferno & vanilla JS apps, React libraries and other npm modules for the web, with no configuration (until you need it)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

custom webpack rule for sass processing error

ewingrj opened this issue · comments

This issue is a:

  • Question / support request

What is the correct way to have a custom sass rule so I can use the resolve-url-loader?

It appears in the docs that I can use the default nwb loader configs in a custom rule...

I have tried the following config, but get an error: Error: No PostCSS Config found in:

 extra: {
      output: {
        filename: '[name].bundle.js',
      },
      module: {
        rules: [
          {
            test: /\.s[ac]ss$/,
            use: [
              {
                'loader': 'mini-css-extract-plugin/dist/loader.js',
              },
              {
                loader: 'css-loader',
                options: {
                  'importLoaders': 1,
                },
              },
              {
                loader: 'postcss-loader',
                options: {
                },
              },
              {loader: 'resolve-url-loader',},
              {
                loader: 'sass-loader',
                options: {
                  // This allows us to resolve node_modules w/o a ~ prefix, and
                  // allows us to import these files w/ django_sass_processor
                  includePaths: [path.resolve(__dirname, './node_modules')],
                },
              },
            ],
          },
        ],
      },

It would be great to be able to configure the nwb-sass plugin to use the resolve-url-loader if possible. insin/nwb-sass#3