Skip to content

Error: Expected an opening square bracket. #19

@guydumais

Description

@guydumais

The compilation was failing using YARN BUILD with Next.js 10 and React.js 17:

Failed to compile.

Error: Expected an opening square bracket.

> Build error occurred
Error: > Build failed because of webpack errors
    at ...\node_modules\next\dist\build\index.js:15:918
    at async ...\node_modules\next\dist\build\tracer.js:3:470
error Command failed with exit code 1.

To fix it, I replaced the code in postcss.config.js with this one :

module.exports = {
  plugins: {
    'postcss-flexbugs-fixes': {},
    'postcss-preset-env': {
      autoprefixer: {
        flexbox: 'no-2009',
      },
      stage: 3,
      features: {
        'custom-properties': false,
      },
    },
    '@fullhuman/postcss-purgecss': {
      content: [
          './pages/**/*.{js,jsx,ts,tsx}',
          './components/**/*.{js,jsx,ts,tsx}'
      ],
      defaultExtractor: content => content.match(/[\w-/:]+(?<!:)/g) || [],
      safelist: ["html", "body"]
    },
    'tailwindcss': {}
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions