webpack-cli: `webpack.config.ts` can not be resolved any more after upgrading to 3.2.0

Describe the bug

As Title.

What is the current behavior?

(function (exports, require, module, __filename, __dirname) { import path from 'path';
                                                                     ^^^^

SyntaxError: Unexpected identifier

To Reproduce Steps to reproduce the behavior: use webpack.config.ts with ts-node

Expected behavior build successfully

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 16
  • Comments: 21 (8 by maintainers)

Commits related to this issue

Most upvoted comments

I was having the same issue above (SyntaxError: Unexpected identifier) when importing path. It was resolved once I explicitly included ts-node as a devDependency (i.e.yarn add --dev ts-node).

Not specific to typescript, we have the same problem with webpack.config.babel.js. Downgrading webpack-cli to 3.1.2 fixes this

Looks like this was fixed in the 3.2.1 release.

FYI: it’s fixed for webpack.config.babel.js for me as well.

Gotcha. I think that we will need to add interpret again, we removed that dependency. Fixing this this week sorry for the inconvience

I have the same issue for the following versions

    "webpack": "^4.31.0",
    "webpack-cli": "^3.3.2"

and it worked after adding tihs: TS_NODE_PROJECT=\"tsconfig-for-webpack-config.json\" but previously with this versoins I didn’t have the issue:

    "webpack": "^4.29.0",
    "webpack-cli": "^3.2.1"