我想从CDN下载脚本并使用它 [英] I want to download a script from cdn and use it

查看:178
本文介绍了我想从CDN下载脚本并使用它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想下载一个脚本并使用它而不是使用CDN

I wanted to download a script and use it instead of using cdn

cdn链接是

<script src="https://cdn.jsdelivr.net/npm/es6-object-assign@1.1.0/dist/object-assign-auto.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/text-encoding@0.6.4/lib/encoding.min.js"></script>

相反,我下载并尝试使用

Instead I downloaded and tried to use

<script src="./js/encoding.js"></script>
  <script src="./js/object-assign-auto.js"></script>

但是它不起作用


未找到-服务器未找到与请求的
URI(统一资源标识符)匹配的任何内容。

NOT FOUND - The server has not found anything matching the requested URI (Uniform Resource Identifier).

我认为我没有以正确的方式使用下载的文件。请提出建议,谢谢

I think I am not using the downloaded files in the right way. suggestions please, thank you

推荐答案

将thr脚本添加到 angular.json 文件,在脚本部分中。

Add thr scripts to the angular.json file, in the scripts sections.

路径从文件夹的根目录开始,因此应为 js / encoding.js

Paths starts at the root of your folder, so it should be js/encoding.js :

    "build": {
      "builder": "@angular-devkit/build-angular:browser",
      "options": {
        ...
        "assets": [...],
        "styles": [...],
        "scripts": [
          "js/encoding.js"
        ]
      },

这篇关于我想从CDN下载脚本并使用它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆