0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Module not found: Error: Can't resolve './src' in | webpackエラー

Posted at

webpackをセッティングしてJSファイルを2つ用意してnpm run devを実行した時に以下のエラーが出ました。

error.sh
ERROR in main
Module not found: Error: Can't resolve './src' in

これはsrcディレクトリの中にモジュールが見つかりませんでしたという内容です。

そこでルートに置いてしまっていた2つのJSファイルを./src/*.jsのような形でsrcディレクトリの中に入れてnpm run devを実行したところdistディレクトリが作成されmain.jsが生成されていました。

これはおそらくwebpackの仕様で、デフォルトでsrcディレクトリ内のファイルを吸い上げ、distディレクトリにまとめて吐き出すという形なのだと思います。

同様のエラーに遭遇した方はお試しください。

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?