Skip to content

[react-flexbox-grid] From [next.config.js] How to set it up?Β #165

@arsendev

Description

@arsendev

Hello, I'd like to use [react-flexbox-grid] to do my work now. I'm working on next.js.
No different. I'd like to set it up in [next.config.js], but it keeps failing.

I use style file as [scss].

this is next.config.js file

module.exports = withCss(
  withSass({
    publicRuntimeConfig: {
      API_URL: process.env.API_URL,
      localeSubpaths: typeof process.env.LOCALE_SUBPATHS === 'string' ? process.env.LOCALE_SUBPATHS : 'none'
    },
    cssModules: true,
    cssLoaderOptions: {
      importLoaders: 1,
      localIdentName: '[local]___[hash:base64:5]',
    },
    assetPrefix: process.env.S3_URL ? process.env.S3_URL : '',
    progressBar: {
      profile: true
    },
    webpack(config, options) {
      config.resolve.mainFields = ["main", "browser", "module"];
      config.module.rules.push(
        {
          test: /\.(jpe?g|png|svg|gif|eot|ttf|woff|woff2)$/,
          use: [
            {
              loader: 'file-loader',
              options: {
                exclude: /node_modules/,
                publicPath: '/_next/static/images/',
                outputPath: 'static/images/',
                name: '[name]-[hash].[ext]'
              }
            }
          ]
        },
        {
          test: /\.css$/,
          loader: 'style!css!postcss',
          include: path.join(__dirname, 'node_modules'), // oops, this also includes flexboxgrid
          exclude: /flexboxgrid/, // so we have to exclude it
          }
      )

      return config;
    }
  })
)

err msg

ValidationError: Invalid options object. CSS Loader has been initialised using an options object that does not match the API schema.
 - options has an unknown property 'localIdentName'. These properties are valid:
   object { url?, import?, modules?, sourceMap?, importLoaders?, localsConvention?, onlyLocals? }

err

I tried the tutorial, but it keeps going up.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions