question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

InlineChunkHtmlPlugin Cannot read property 'endsWith' of undefined

See original GitHub issue

Is this a bug report?

Yes

Did you try recovering your dependencies?

Yes.

Which terms did you search for in User Guide?

InlineChunkHtmlPlugin publicPath

Environment

The npx create-react-app --info commands generates an error…

Steps to Reproduce

I have a project based on CRA2.0 that I ejected. I am using Styleguidist to show my React components. When I build with Styleguidist it uses the webpack.config.prod.js of my project to obtains some data. The issue is I am getting the following error:

TypeError: Cannot read property 'endsWith' of undefined
TypeError: Cannot read property 'endsWith' of undefined
    at InlineChunkHtmlPlugin.apply (C:\Git\web-react-components-library\node_modules\react-dev-utils\InlineChunkHtmlPlugin.js:33:21)
    at webpack (C:\Git\web-react-components-library\node_modules\webpack\lib\webpack.js:47:13)
    at build (C:\Git\web-react-components-library\node_modules\react-styleguidist\scripts\build.js:5:9)
    at commandBuild (C:\Git\web-react-components-library\node_modules\react-styleguidist\bin\styleguidist.js:96:19)

When I look at the InlineChunkHtmlPlugin apply function I can see that it looks for compiler.options.output.publicPath but in case of Styleguidist this value is undefined.

Expected Behavior

The InlineChunkHtmlPlugin apply function should probably test if the publicPath is valid before continuing.

Thanks.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
stronguicommented, Nov 22, 2018

@DavidHenri008 This error shouldn’t arrive if you have publicPath defined in your webpack config.

module.exports = {
	...,
	output: {
		publicPath: 'MUST_BE_STRING'
	},
	...,
}
0reactions
Timercommented, Dec 23, 2018

We cannot reproduce this. If this is for an ejected project we’d be happy to take a PR making our plugins more flexible.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot read property 'endsWith' of undefined - Redux Toolkit ...
I'm getting back TypeError: Cannot read property 'endsWith' of undefined when running the test with the addMatcher s in the slice.
Read more >
Error: Cannot read property "endsWith" of undefined
Hello, I have add a button to a page.... now I get error: Cannot read property "endsWith" of undefined Even if I delete...
Read more >
r3f-react-app - CodeSandbox
n\u002F\u002F We can't use a relative path in HTML because we don't want to load ... allows you to set a fallback for...
Read more >
CRA Browser Extension - Bartekus.com
Ever wanted to use CRA as foundation for building an awesome browser extension but weren't sure how to get everything working?
Read more >
webpack怎么配置才能把内联js改为src引用呢? | 菜鸟教程网
__esModule) return e; var r = Object.create(null); if (l.r(r), Object. ... shouldInlineRuntimeChunk && new InlineChunkHtmlPlugin(HtmlWebpackPlugin, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found