【问题标题】:Rxjs link is not working?Rxjs 链接不起作用?
【发布时间】:2018-07-24 12:09:01
【问题描述】:

在 system.config.js 文件中,我使用了这个 rxjs 链接:

'rxjs': 'https://unpkg.com/rxjs@5.5.10/'

**它会产生错误 bcz,它会生成另一个斜杠并将其添加到链接的末尾,这个我的来源的 bcz 没有定义 **

而不是上面的链接,如果我使用这个链接,它将起作用。我想知道原因?

'rxjs': 'https://unpkg.com/rxjs@5.5.10'

我的 system.config.js 文件

System.config({
    transpiler: "typescript",
    typescriptOptions: {
        compilerOptions: {
            target: "umd",
            module: "commonjs",
            moduleResolution: "node",
            emitDecoratorMetadata: true,
            experimentalDecorators: true
        }
    },
    paths: {
        "syncfusion:": "{{:CDN_LINK}}",
        "angular:": "https://unpkg.com/@angular/"
    },
    map: {
        app: 'app',
        typescript: "https://unpkg.com/typescript@2.2.2/lib/typescript.js",
          "@syncfusion/ej2-base": "syncfusion:ej2-base/dist/ej2-base.umd.min.js",
        "@syncfusion/ej2-dropdowns": "syncfusion:ej2-dropdowns/dist/ej2-dropdowns.umd.min.js",
        "@syncfusion/ej2-inputs": "syncfusion:ej2-inputs/dist/ej2-inputs.umd.min.js",
        "@syncfusion/ej2-lists": "syncfusion:ej2-lists/dist/ej2-lists.umd.min.js",
        "@syncfusion/ej2-data": "syncfusion:ej2-data/dist/ej2-data.umd.min.js",
        "@syncfusion/ej2-popups": "syncfusion:ej2-popups/dist/ej2-popups.umd.min.js",
        "@syncfusion/ej2-buttons": "syncfusion:ej2-buttons/dist/ej2-buttons.umd.min.js",
        "@syncfusion/ej2-ng-base": "syncfusion:ej2-ng-base/dist/ej2-ng-base.umd.min.js",
        "@syncfusion/ej2-ng-popups": "syncfusion:ej2-ng-popups/dist/ej2-ng-popups.umd.min.js",
        "@syncfusion/ej2-ng-buttons": "syncfusion:ej2-ng-buttons/dist/ej2-ng-buttons.umd.min.js",
        "@syncfusion/ej2-ng-dropdowns": "syncfusion:ej2-ng-dropdowns/dist/ej2-ng-dropdowns.umd.min.js",
 

        '@angular/core': 'angular:core@5.2.10/bundles/core.umd.js',
        '@angular/common': 'angular:common@5.2.10/bundles/common.umd.js',
        '@angular/compiler': 'angular:compiler@5.2.10/bundles/compiler.umd.js',
        '@angular/http': 'angular:http@5.2.10/bundles/http.umd.js',
        '@angular/forms': 'angular:forms@5.2.10/bundles/forms.umd.js',
        '@angular/router': 'angular:router@5.2.10/bundles/router.umd.js',
        '@angular/platform-browser': 'angular:platform-browser@5.2.10/bundles/platform-browser.umd.js',
        '@angular/platform-browser-dynamic': 'angular:platform-browser-dynamic@5.2.10/bundles/platform-browser-dynamic.umd.js',
        '@angular/material': 'angular:material@5.2.10/bundles/material.umd.js',
        'rxjs': 'https://unpkg.com/rxjs@5.5.10'
    },
    packages: {
        'app': { main: 'main', defaultExtension: 'ts' },
        'rxjs': { main: 'index' },
    }
});
 
System.import('app');
 

【问题讨论】:

    标签: javascript angular rxjs5


    【解决方案1】:

    因为使用:

    'rxjs': 'https://unpkg.com/rxjs@5.5.10/'

    您将获得所有 rxjs JavaScript 文件而不是脚本。

    如果你想使用 rxjs 库,你应该使用:

    'rxjs': 'https://unpkg.com/rxjs@5.5.10'

    【讨论】:

      【解决方案2】:

      尝试以下操作:将带有斜杠和不带斜杠的网址复制粘贴到浏览器中。

      带斜线的将指向所有JS文件的文件夹,而不带斜线的实际上将您转移到文件:

      https://unpkg.com/rxjs@5.5.10/Rx.js

      你的实际配置文件是什么

      【讨论】:

      • 我在上面添加了我的文件,请检查一下
      • 那不是问题......如果我给斜杠(在链接末尾),当它生成完整的链接路径时......链接变成了这样...... .........."unpkg.com/rxjs@5.5.10//unpredit.ts"
      • 我明白了。奇怪的行为,这仍然不会回答“为什么?”,但在 github 存储库中它也没有斜线,请参阅link
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-12-24
      • 2013-01-10
      • 2015-04-26
      • 2012-10-07
      • 2012-08-05
      • 2013-05-22
      • 2012-11-12
      相关资源
      最近更新 更多