Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove sourceMappingURL from the angular universal build?

I'm using this repo as base. I have solved almost every other plugin's errors but I'm not able to solve this error.

No other plugin expects a .map file when making an SSR build as it is a production one. But I don't know from where is it creeping in.

Here is the line causing the error. in server.js file.

margin: -1px 0; }\n\n/*# sourceMappingURL=swiper.component.css.map

I don't want to remove it manually every time I make a build so how to solve the issue and what the issue could be.

ERROR Something went wrong please try again later! ERROR { Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'swiper.component.css.map' Error: Cannot match any routes. URL Segment: 'swiper.component.css.map' at ApplyRedirects.noMatchError (E:\xampp\htdocs\havemybooks\dist\server.js:146214:16) at CatchSubscriber.selector (E:\xampp\htdocs\havemybooks\dist\server.js:146195:29) at CatchSubscriber.error (E:\xampp\htdocs\havemybooks\dist\server.js:29486:31) at MapSubscriber.Subscriber._error (E:\xampp\htdocs\havemybooks\dist\server.js:20931:26)

Update:

I found the culprit it's the plugin which has inline /*# sourceMappingURL=swiper.component.css.map */ So is there a webpack configuration to replace the inline sourcemaps already present.

I tried --devtool false with webpack but no success

like image 979
Black Mamba Avatar asked Jul 28 '26 23:07

Black Mamba


1 Answers

This is a bug in angular cli. But you can manually specify to not to produce source maps in angular.json file.

"server": {
          "builder": "@angular-devkit/build-angular:server",
          "options": {
            ...
            "sourceMap": false
          },
         ...
 }
like image 58
asdasd Avatar answered Jul 31 '26 13:07

asdasd



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!