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

Cannot read property 'replace' of undefined #12

Closed
alexmcmillan opened this issue Nov 22, 2015 · 1 comment
Closed

Cannot read property 'replace' of undefined #12

alexmcmillan opened this issue Nov 22, 2015 · 1 comment

Comments

@alexmcmillan
Copy link

I'm currently migrating a small project to use Babel v6, but I'm getting the titular error with this trace when attempting to run webpack-dev-server:

TypeError: Cannot read property 'replace' of undefined
at Tapable.join (C:\project\node_modules\memory-fs\lib\join.js:11:73)
at Tapable.<anonymous> (C:\project\node_modules\enhanced-resolve\lib\FileAppendPlugin.js:14:19)
at Tapable.applyPluginsParallelBailResult (C:\project\node_modules\tapable\lib\Tapable.js:139:14)
at Tapable.<anonymous> (C:\project\node_modules\enhanced-resolve\lib\Resolver.js:103:8)
at Tapable.Resolver.forEachBail (C:\project\node_modules\enhanced-resolve\lib\Resolver.js:196:3)
at Tapable.doResolve (C:\project\node_modules\enhanced-resolve\lib\Resolver.js:102:7)
at Tapable.resolve (C:\project\node_modules\enhanced-resolve\lib\Resolver.js:45:14)
at Tapable.resolve (C:\project\node_modules\enhanced-resolve\lib\UnsafeCachePlugin.js:23:14)
at C:\project\node_modules\webpack\lib\NormalModuleFactory.js:169:12
at C:\project\node_modules\async\lib\async.js:356:13

It appears the error is in join.js which begins with:

module.exports = function join(path, request) {
    if(request == "") return normalize(path);
    ...
}

Obviously, FileAppendPlugin.js is calling join with undefined as the second argument but undefined != "", so this escape only works if an empty string is passed, and execution continues if undefined is passed (and the rest of the function assumes a value). Is this function intentionally tossing its toys, or is this a simple oversight that could be handled with something like:

if (!request) return normalize(path);

?

Sure, I can move onto working out why FileAppendPlugin is passing undefined (assumedly erroneously), but this problem remains.

@sokra sokra closed this as completed Sep 7, 2016
gajus pushed a commit that referenced this issue Sep 7, 2016
@NeverMore93
Copy link

could you tell how to update join.js? please

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

3 participants