使用react-dates

时间:2018-01-22 18:24:11

标签: reactjs react-redux react-dates

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

我从网络包收到错误

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)

0 个答案:

没有答案