Error while trying to import css files from node_modulesJanuary 13, 2020 at 6:07pm
Hello, I get the error 'SyntaxError: Unexpected token . ' from config.js file in .infrastructure_temp folder. It happens when I try to build a project, which imports a css file from react-datepicker module. It seems that the build process try to import it as a js module and not as css file, it also happens when I import another module, that use in its own css file. Thank you.
January 13, 2020 at 6:56pm
January 22, 2020 at 12:24pm
Hi, sorry it took me some time. But I found a solution. You need to import the css like: import '../../node_modules/react-datepicker/dist/react-datepicker.css'; It's a relative path to the module in your node_modules folder. How many folders you'll need to go up ("../") depends on where you're file is located