Webpack: Uncaught ReferenceError: vendor_bd98b4ed288c6b156cc9 not defined

I used the yo generator template described here to create an ASP.NET Core application with Angular2 as an interface. But randomly, after changing the css files and saving them (which cause Webpack to reboot), I got the following exception in the client console:

Uncaught ReferenceError: vendor_bd98b4ed288c6b156cc9 is not defined at Object.<anonymous> (external "vendor_bd98b4e…":1) at __webpack_require__ (bootstrap 4cd8e17…:659) at fn (bootstrap 4cd8e17…:83) at Object.module.exports (eventsource.js from dll-reference vendor_bd98b4e…:1) at __webpack_require__ (bootstrap 4cd8e17…:659) at fn (bootstrap 4cd8e17…:83) at Object.<anonymous> (main-client.js?v=4atoLMuOmZwmyVdq2ky2bYoBjkmqmVnuPNSIFOD8Qjs:2625) at __webpack_require__ (bootstrap 4cd8e17…:659) at module.exports (bootstrap 4cd8e17…:708) at bootstrap 4cd8e17…:708 

In the dist/main-client.js I found the following lines:

 module.exports = vendor_bd98b4ed288c6b156cc9; /***/ }), /* 1 */ /***/ (function(module, exports, __webpack_require__) { module.exports = (__webpack_require__(0))(0); 

The error wwwroot/dist away when I delete the whole wwwroot/dist folder and rebuild the Webpack packages. Then the random string changes as follows:

 module.exports = vendor_9dc79ae12948ed5e4b95; 

It seems like a bit of caching. What can cause this?

I am using version 2.2.1 of Webpack.

+5
source share
1 answer

I followed the tutorial and had the same problem. The tutorial states that you need to update webpack.config.vendor.js and restart webpack after adding a new library

 > webpack --config webpack.config.vendor.js > webpack 

To help me in the future, I put this in my package.json file according to the scripts:

 "scripts": { ... Other scripts ... "start": "webpack --config webpack.config.vendor.js && webpack && cross-env ASPNETCORE_ENVIRONMENT=Development dotnet run" }, "devDependencies":{ ... Other Dependencies ... "cross-env":"^5.0.1" } 

Below is a tutorial that explains this http://blog.stevensanderson.com/2016/10/04/angular2-template-for-visual-studio/

Hope this helps!

0
source

Source: https://habr.com/ru/post/1263936/


All Articles