Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module build failed: TypeError: Path must be a string. Received undefined #246

Closed
svdoever opened this issue Jul 14, 2016 · 3 comments
Closed

Comments

@svdoever
Copy link

This error is given if no tsconfig.json is available... took me hours until I found the blogpost https://www.garysieling.com/blog/fixing-webpack-error-path-must-string-received-undefined

@soda-x
Copy link

soda-x commented Jul 19, 2016

plus 1

@chuwik
Copy link

chuwik commented Aug 29, 2016

I've done a bit of digging into this. In my case, I was setting the compiler options only though the webpack ts config, and not having any tsconfig.json file present in my project. While using node 5.X, this was working fine; after updating to node 6.X, I started seeing this error.

I've isolated the problem to line 156 of index.js:
configParseResult = compiler.parseJsonConfigFileContent(configFile.config, compiler.sys, path.dirname(configFilePath));

And I suspect the same problem would occur in line 159 if you're using a TS compiler < 1.7:
configParseResult = compiler.parseConfigFile(configFile.config, compiler.sys, path.dirname(configFilePath));

The problem is with path.dirname. In node 5.x, path.dirname(undefined) returns '.', whereas in node 6.x it returns undefined. That's why an exceptions gets thrown in node 6.x if you're using tsloader without a tsconfig.json file.

@jbrantly @johnnyreilly Seems like PR #202 is addressing this problem.

@johnnyreilly
Copy link
Member

Fixed with 0.9.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants