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
- fix(bin): extension detection (#724) — committed to lakatostamas/webpack-cli by lakatostamas 5 years ago
- fix webpack.config.ts syntax errors see https://github.com/webpack/webpack-cli/issues/724 — committed to arolson101/ag by arolson101 5 years ago
- tests(bin): add `webpack.config.babel.js` related test (#724) — committed to lakatostamas/webpack-cli by lakatostamas 5 years ago
- tests(bin): add `.babelrc` to webpack-babel-config test (#724) — committed to lakatostamas/webpack-cli by lakatostamas 5 years ago
- chore(dependency): add `node-ts` as devDependency (#724) — committed to lakatostamas/webpack-cli by lakatostamas 5 years ago
- tests(bin): add `webpack.config.ts` related test (#724) — committed to lakatostamas/webpack-cli by lakatostamas 5 years ago
- Merge pull request #728 from lakatostamas/fix/bin-extensions fix(bin): extension detection (#724) — committed to webpack/webpack-cli by evenstensberg 5 years ago
I was having the same issue above (
SyntaxError: Unexpected identifier
) when importingpath
. It was resolved once I explicitly includedts-node
as adevDependency
(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 inconvienceI have the same issue for the following versions
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: