question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Webpack needs appropriate loader: `Unexpected token .`

See original GitHub issue

Hi, using ES6 + Webpack I get the following error when I add require('react-datepicker/dist/react-datepicker.css');

ERROR in ./~/react-datepicker/dist/react-datepicker.css
Module parse failed: /Users/.../node_modules/react-datepicker/dist/react-datepicker.css Line 1: Unexpected token .
You may need an appropriate loader to handle this file type.
| .react-datepicker__tether-element-attached-top .react-datepicker__triangle, .react-datepicker__tether-element-attached-bottom .react-datepicker__triangle, .react-datepicker__year-read-view--down-arrow {
|   margin-left: -8px;
|   position: absolute;

Has anyone seen this error or know what loader I’m missing?

"webpack": "1.12.11"
"react": "^0.14.7"

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:3
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

8reactions
brendoncocommented, Nov 24, 2016

how did you manage to load the react-datepicker.min.css?

I’m using webpack.config.js loader but doesnt work:

{
        test: /\.(scss|css)$/,
        include: [path.resolve(__dirname, "src/scss/"), path.resolve(__dirname, "node_modules/react-datepicker/dist/")],
        loaders: ["style", "css?sourceMap", "sass?sourceMap"],
      },
4reactions
rafeememoncommented, Mar 29, 2016

@diffractometer, I think the issue is that your config is set up to read css files from your src directory and not node_modules where the datepicker stylesheet will live.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Module parse failed: Unexpected token. You may ... - GitHub
You may need an appropriate loader to handle this file type, currently no loaders ... const createExpoWebpackConfigAsync = require('@expo/webpack-config'); ...
Read more >
Module parse failed: Unexpected token - Stack Overflow
Apparently it happened because you have two module properties in the webpack config object. Given JS objects can only hold one value per...
Read more >
039;t build with webpack - Material Design for Bootstrap
css 6:3 Module parse failed: Unexpected token (6:3) You may need an appropriate loader to handle this file type, currently no loaders are...
Read more >
you may need an appropriate loader to handle this file type react
Hi, using ES6 + Webpack I get the following error when I add require('react-datepicker/dist/react-datepicker.css');. ERROR in ./~/react-datepicker/dist/react- ...
Read more >
[Help] Module parse failed: Unexpected token . Babel not ...
npm install and make get many similar errors like the following. ... failed: Unexpected token (64:16) You may need an appropriate loader to ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found