Bundler Excluding Minified Files
In MVC4, the bundling system sometimes encounters an issue where it excludes files with the ".min.js" extension. To resolve this, ensure that the bundle declaration includes ".js" extensions for minified files. For instance, instead of:
1 2 |
|
Use:
1 2 |
|
If renaming the files is not preferred, an alternative solution involves adding specific file patterns to the bundle's ignore list. This can be done by overriding the AddDefaultIgnorePatterns method in the BundleCollection class, as follows:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|
By overriding the AddDefaultIgnorePatterns method, you can specify that minified JavaScript and CSS files should be ignored when optimization is disabled in the deployment environment. This ensures that the bundler includes these files when serving the site in development or testing environments.
The above is the detailed content of How to Fix Bundler Excluding Minified Files in MVC4?. For more information, please follow other related articles on the PHP Chinese website!