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.

[0] Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: Module: /Users/....../webpack.config.js [0] require() of ES modules is not supported.と出た時の対処法

Posted at

解決法

拡張子を変更すると解決しました!!
before

webpack.config.js

after

webpack.config.cjs

そして、package.jsonも変更

{
  ...略
  "scripts": {
    "build": "webpack --config webpack.config.cjs",
    "start": "webpack serve --config webpack.config.cjs"
  },
  ...略
}

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?