New ag-grid CSS import path throws error during build process in my react app

Viewed 40

I'm doing some changes to my React project (React version: 16.13.1, created with CRA) in order to upgrade from v27 to v28 of Ag-Grid. One of the changes requested is the new way to import the css files. It used to be

import 'ag-grid-community/dist/styles/ag-grid.css'

and now it has to be like this:

import 'ag-grid-community/styles/ag-grid.css'

This is generates an error during the build process:

Failed to compile.

./node_modules/ag-grid-community/styles/ag-grid.css
ParserError: Syntax Error at line: 1, column 83


error Command failed with exit code 1.

This makes me think it is a webpack problem, maybe a loader?. If it is the case, is there a way to handle this error without ejecting the webpack config?

Other clues I explored:

  • is it because I try to import CSS from a module?
  • is it a problem with the react version (16.13.1)?

Any ideas and solutions will be much appreciated.

0 Answers
Related