0

我正在尝试为我的 react-redux 应用程序实现 airbnbs react-dates datepicker。

我从 webpack 收到的错误:

ERROR in ./node_modules/react-dates/lib/css/_datepicker.css
Module parse failed: C:\my-app\node_modules\react-dates\lib\css\_
datepicker.css Unexpected token (1:0)
You may need an appropriate loader to handle this file type.
| .CalendarDay {
|   border: 1px solid #e4e7e7;
|   padding: 0;
 @ ./src/components/ExpenseForm.js 15:0-46
 @ ./src/components/AddExpense.js
 @ ./src/routers/AppRouter.js
 @ ./src/app.js
 @ multi (webpack)-dev-server/client?http://localhost:8080 ./src/app.js

我正在使用的软件包版本:

react-dates@12.7.0 react-addons-shallow-compare@15.6.0

我如何导入它们(在我的组件中):

import { SingleDatePicker } from 'react-dates'
import 'react-dates/lib/css/_datepicker.css'

我应该升级到最新版本 - 这会再次破坏我的应用程序吗?

客户端错误(chrome:控制台日志):

Uncaught Error: Module parse failed: C:\my-app\node_modules\react-dates\lib\css\_datepicker.css Unexpected token (1:0)
You may need an appropriate loader to handle this file type.
| .CalendarDay {
|   border: 1px solid #e4e7e7;
|   padding: 0;
    at eval (553:1)
    at Object.<anonymous> (bundle.js:3558)
    at __webpack_require__ (bundle.js:20)
    at eval (ExpenseForm.js?8c50:3)
    at Object.<anonymous> (bundle.js:3146)
    at __webpack_require__ (bundle.js:20)
    at eval (AddExpense.js?a8b4:2)
    at Object.<anonymous> (bundle.js:3139)
    at __webpack_require__ (bundle.js:20)
    at eval (AppRouter.js?e39b:5)
4

0 回答 0