LoginSignup
1
1

More than 5 years have passed since last update.

moment-timezoneのエラー「Error: Can't resolve 'json'」の解決策

Last updated at Posted at 2019-02-26

環境

OS: Mac Mojave 10.14.3
webpack: 4.16.1
moment-timezone: 0.5.23

エラー事象

moment-timezoneを追加した後にビルドしようとすると以下のエラーが発生

Module not found: Error: Can't resolve 'json' in '/app-path/node_modules/moment-timezone'

解決策

webpack.config.jsから以下の行を除外する。

webpack.config.js
  module: {
    rules: [
    -   {
    -   test: /\.json$/,
    -   loader: 'json'
    - }

参考

イシューが上がってました。
https://github.com/moment/moment-timezone/issues/671

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1