简体   繁体   English

Angular 6:脚本无法从 angular.json 正确加载

[英]Angular 6 : Scripts not loading correctly from angular.json

I have not found yet the solution of this in the internet.我还没有在互联网上找到解决方案。

Angular brought this similar Github Issue , but can't find any solution there. Angular 带来了这个类似的Github 问题,但在那里找不到任何解决方案。

I have added my script files to angular.json such as (in both build & test scope):我已将我的脚本文件添加到 angular.json 中,例如(在构建和测试范围内):

        "assets": [
          "src/favicon.ico",
          "src/assets"
        ],
        "styles": [
          "src/styles.css"
        ],
        "scripts": [
          "src/assets/plugins/jquery/jquery-1.11.3.min.js",
          "src/assets/plugins/jquery-ui-1.11.4.custom/jquery-ui.min.js",
          "src/assets/plugins/bootstrap/js/bootstrap.min.js",
          "src/assets/plugins/owl-carousel/owl.carousel.min.js",
          "src/assets/plugins/bootstrap-select/js/bootstrap-select.min.js",
          "src/assets/js/jquery.subscribe-better.js",

          "src/assets/js/moment-with-locales.min.js",
          "src/assets/plugins/countdown/jquery.plugin.min.js",
          "src/assets/plugins/countdown/jquery.countdown.min.js",
          "src/assets/js/theme.js"
        ]

I am getting the css styles but some scripts are not working correctly.我正在获取 css 样式,但某些脚本无法正常工作。

Any solution?有什么解决办法吗?

After a couple of hours of trial-and-error, I found out that I was putting the script paths under the json key of经过几个小时的反复试验,我发现我将脚本路径放在了

/projects/project-name/architect/test/options/scripts

instead of (if not both)而不是(如果不是两者)

/projects/project-name/architect/build/options/scripts

PS: It may also apply to the "styles.css not working" type of questions. PS:它也可能适用于“styles.css not working”类型的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM