我的申请有问题。我有一个网站。我使用 date-fns 来显示基于用户语言的格式化日期。
它工作得很好,但我已经更新了 date-fns,从那以后我收到了一个警告。在我的 JavaScript 代码中,我使用:
const locale = require(`date-fns/locale/${props.match.params.lang}`)
有了这个,我可以生成正确的格式,如下所示:
format(new Date(), 'D MMMM YYYY', { locale })
它有效,但我不喜欢在构建 webpack 时收到的这个警告。你能帮我理解我的代码有什么问题吗?如果它在 webpack 配置或包含中。
You may need an appropriate loader to handle this file type.
>frontend | > declare module 'date-fns/locale/fr' { }
>frontend | |
>frontend | @ ./node_modules/date-fns/locale sync ^\.\/.*$ ./fr/index.d.ts
>frontend | @ ./assets/javascripts/features/weather/components/home-header.js
>frontend | @ ./assets/javascripts/features/weather/components/home.js
>frontend | @ ./assets/javascripts/features/weather/containers/home-container.js
>frontend | @ ./assets/javascripts/features/weather/containers/app.js
>frontend | @ ./assets/javascripts/features/weather/index.js
>frontend | @ ./assets/javascripts/app/router.js
>frontend | @ ./assets/javascripts/index.js
>frontend | @ multi (webpack)-dev-server/client?http://0.0.0.0:3000 ./assets/javascripts/index