I trying bundle and minify my CSS and JS files in ASP.NET Core 3.0 with BuildBundlerMinifier.Core
.
Also Installed Bundler & Minifier
extension for Visual Studio 2019.
When I try Debug the project, it working correctly without error but when I rebuild it, I'm getting the following error;
Object reference not set to an instance of an object
I don't get an error when restart Visual Studio and I can debug the project again but If I rebuild it again, I'm getting the error.
It's bundleconfig.json
file
[
{
"outputFileName": "wwwroot/assets/css/style.bundle.min.css",
"inputFiles": [
"wwwroot/assets/plugins/global/plugins.bundle.css",
"wwwroot/assets/css/style.bundle.css",
"wwwroot/assets/css/skins/header/base/light.css",
"wwwroot/assets/css/skins/header/menu/light.css",
"wwwroot/assets/css/skins/brand/light.css"
],
"sourceMap": false,
"sourceMapRootPath": null
}
,
{
"outputFileName": "wwwroot/assets/js/scripts.min.js",
"inputFiles": [
"wwwroot/assets/plugins/global/plugins.bundle.js",
"wwwroot/assets/js/scripts.js",
"wwwroot/assets/js/pages/dashboard.js",
"wwwroot/content/js/mobil-detect.js",
"wwwroot/content/js/lazy-img.js",
"wwwroot/content/js/ziyaretci.js"
]
}
]
Visual Studio, Bundler & Minifier extension, BuildBundlerMinifier and BuildBundlerMinifier.Core are up to date How can I fix it ?
This can be an issue with the syntax in the source of one of your js files. In my case, using the nullish coalescing operator "??" was the issue. Replaced it with a simple "if" null check and the compilation error disappeared.
Solved by refactoring all "??" nullish coalescing operators with "?:" conditional (ternary) operators.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With