webpack-cli: webpack-cli 4.x doesn't work with a TypeScript config file

Describe the bug

Here’s my webpack.config.ts : https://gist.github.com/yovanoc/cd86b8f226f45dfb465d2c2d9474862c

What is the current behavior?

This error happen on build:

$ webpack --config webpack.config.ts
⬢ webpack:  TypeError [ERR_INVALID_ARG_TYPE]: The "id" argument must be of type string. Received type undefined
    at validateString (internal/validators.js:118:11)
    at Module.require (internal/modules/cjs/loader.js:1016:3)
    at require (/Users/devchris/Documents/code/nodejs/project/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
    at /Users/devchris/Documents/code/nodejs/project/packages/cli/node_modules/webpack-cli/lib/groups/config.js:60:39
    at Array.forEach (<anonymous>)
    at ConfigGroup.requireConfig (/Users/devchris/Documents/code/nodejs/project/packages/cli/node_modules/webpack-cli/lib/groups/config.js:59:33)
    at ConfigGroup.resolveConfigFiles (/Users/devchris/Documents/code/nodejs/project/packages/cli/node_modules/webpack-cli/lib/groups/config.js:128:41)
    at ConfigGroup.run (/Users/devchris/Documents/code/nodejs/project/packages/cli/node_modules/webpack-cli/lib/groups/config.js:177:20)
    at /Users/devchris/Documents/code/nodejs/project/packages/cli/node_modules/webpack-cli/lib/webpack-cli.js:102:63
    at Array.map (<anonymous>) {
  code: 'ERR_INVALID_ARG_TYPE'
}

Additional context

"webpack": "^5.0.0-beta.7",
"webpack-cli": "^4.0.0-beta.1",

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 3
  • Comments: 18 (6 by maintainers)

Most upvoted comments

Hope it will be tackled one day 👍

Nope, nothing fix this issue. I already read https://webpack.js.org/configuration/configuration-languages/#typescript

I think the issue is related to node13 and/or these modules versions together. Because just stay in the version ^3.3.10 all working as expected.