webpack-dev-server: Uncaught TypeError: Cannot read property 'replace' of null

Hi, with version 1.14.1 I’m receiving this error:

Uncaught TypeError: Cannot read property 'replace' of null

I’m using an inline script in the index.html to load the .JS file (which is in the folder declared by publicPath) and I enabled the hot module replacement to receive updates.

Using version 1.14.0, it works fine (so at the moment I am not updating the webpack-dev-server module to 1.14.1).

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 10
  • Comments: 22 (1 by maintainers)

Commits related to this issue

Most upvoted comments

Same problem here because of the Google Tag Manager script in the index.html

Just to point out for anyone else having the same issue - For me this issue occurred because of using the Poper Blocker chrome extension. I didn’t have no script tag without ‘src’ attribute in the page I was working on, so it was very confusing to understand that this extension injects a script tag (without an ‘src’ attribute) during the page loading.

I have disabled the extension until this issue will be fixed.

Also getting this problem with the similar script injections. The solution provided above (downgrading to 1.14.0) works for me.

I was able to work around this with a hack-ish change:

<script>
    document.currentScript.src =''; // So that the script executes, but later has a src.

    // ... Do rest of work.   
</script>

FYI: This is happening when you have a <script /> tag in your code that doesn’t have a src attribute.