themgoncalves/react-loadable-ssr-addon

Unhandled rejection TypeError: Path must be a string. Received undefined

endiliey opened this issue · 1 comments

Issue Title

Bug caused due to 0.1.7 from 6c18c7a

Expected Behavior

No error

Current Behavior

Unhandled rejection TypeError: Path must be a string. Received undefined
    at assertPath (path.js:28:11)
    at Object.resolve (path.js:1168:7)
    at ReactLoadableSSRAddon.get (/home/travis/build/endiliey/endiliey.github.io/website/node_modules/react-loadable-ssr-addon/lib/ReactLoadableSSRAddon.js:246:31)
    at ReactLoadableSSRAddon.writeAssetsFile (/home/travis/build/endiliey/endiliey.github.io/website/node_modules/react-loadable-ssr-addon/lib/ReactLoadableSSRAddon.js:189:25)

Possible Solution

I think filename should not be defined here.

const { outputPath, options: { filename, devServer } } = this.compiler;

It should be

const filename = this.options.filename

This is the line that causes the error

return path.resolve(outputPath, filename);

Previously it was

return path.resolve(this.compiler.outputPath, this.options.filename);

I can submit a PR

@endiliey thanks for spotting that and create a fix in PR #12 💪