wagramdeveloper
3 months ago
2171
4
Mix

Mix, npm run hot, browser crash: Uncaught TypeError: Cannot read property 'call' of undefined

Posted 3 months ago by wagramdeveloper

This is Laravel Framework 6.0.3, npm version 6.9.0, Fedora 29, webpack [email protected]

Following the Laravel Mix documentation I added

    .options({
        hmrOptions: {
            host: 'xxx.yyy',
            port: 3000,
        },
    })

to webpack.mix.js, otherwise no changes.

This happens with the example route using welcome.blade.php as well as my own blade templates. I am running a Laravel website pointing app.js and app.cs at port 3000 where I am running npm run hot.

When running in Chrome (Version 78.0.3890.0 (Official Build) canary (64-bit)) with the developer tools open, Chrome stops with the following error:

app.js:727 Uncaught TypeError: Cannot read property 'call' of undefined
    at __webpack_require__ (app.js:727)
    at fn (app.js:101)
    at eval (app.scss?e8be:1)
    at Object../node_modules/extract-text-webpack-plugin/dist/loader.js?!./node_modules/style-loader/index.js!./node_modules/css-loader/index.js?!./node_modules/postcss-loader/src/index.js?!./node_modules/resolve-url-loader/index.js?!./node_modules/sass-loader/dist/cjs.js?!./resources/sass/app.scss (app.js:1164)
    at __webpack_require__ (app.js:727)
    at fn (app.js:101)
    at eval (app.scss?11e7:2)
    at Object../resources/sass/app.scss (app.js:1737)
    at __webpack_require__ (app.js:727)
    at fn (app.js:101)

When I set a break point at the offending line (checking for undefined modules[moduleId]:

/******/        modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId));

I see that the offending moduleId is ./node_modules/css-loader/lib/css-base.js. That file is definitely present in node_modules.

The example component is loaded and changes to ExampleComponent.vue are reflected in the browser immediately so it is not clear if this crash affects the web page in any way.

There are a few hits to possibly related github issues, mostly in webpack itself, mentioning the error message in various contexts, but I can't see a clear solution for my setup. It seems to possibly be an intermittent problem for some people.

Does anyone know how to solve this problem? Does the crash have any implications for the web page?

Thanks

Please sign in or create an account to participate in this conversation.