最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to remove sourceMappingURL from the angular universal build? - Stack Overflow

programmeradmin2浏览0评论

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=swiperponent.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: 'swiperponent.css.map' Error: Cannot match any routes. URL Segment: 'swiperponent.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=swiperponent.css.map */ So is there a webpack configuration to replace the inline sourcemaps already present.

I tried --devtool false with webpack but no success

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.ponent.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.ponent.css.map' Error: Cannot match any routes. URL Segment: 'swiper.ponent.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.ponent.css.map */ So is there a webpack configuration to replace the inline sourcemaps already present.

I tried --devtool false with webpack but no success

Share Improve this question edited Oct 2, 2018 at 16:52 Black Mamba asked Sep 28, 2018 at 16:20 Black MambaBlack Mamba 15.7k7 gold badges92 silver badges112 bronze badges 3
  • try removing \n\n (margin: -1px 0; }/*# sourceMappingURL=swiper.ponent.css.map) – Gaspar Commented Sep 28, 2018 at 16:32
  • Yes, that will fix the issue. But I don't want to do it manually every time I make a build. – Black Mamba Commented Sep 28, 2018 at 17:27
  • I think its that ponent for simplifying code and build with less space that put \n\n in this line. Try to look some configuration to that ponent (forget the name of it) – Gaspar Commented Sep 28, 2018 at 17:47
Add a ment  | 

1 Answer 1

Reset to default 8

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
          },
         ...
 }
发布评论

评论列表(0)

  1. 暂无评论