在对.NET核心2.0角2 SPA模板错误加载时髦,信息窗口模块

Mat*_*ynn 2 asp.net-core-2.0 angular

我正在尝试将以下插件安装到我的.Net Core SPA;

Angular Google Maps时髦的窗口链接

我已经执行了以下步骤;

在我的package.json中添加了以下内容;

"agm-core": "1.0.0-beta.5",
"agm-snazzy-info-window": "1.0.0-beta.5",
Run Code Online (Sandbox Code Playgroud)

然后,我在Visual Studio和更新的程序包中单击鼠标右键。

然后我加入了模块到我的app.shared.module.ts;

import { AgmCoreModule } from 'agm-core';
import { AgmSnazzyInfoWindowModule } from 'agm-snazzy-info-window';

AgmCoreModule.forRoot({
    apiKey: 'my-api-key'
}),
AgmSnazzyInfoWindowModule
Run Code Online (Sandbox Code Playgroud)

我也因为增加了以下我webpack.config.vendor.js;

const nonTreeShakableModules = [
    ...
    'agm-snazzy-info-window'
];
Run Code Online (Sandbox Code Playgroud)

我组件中的html代码是;

        <agm-map [latitude]="lat" [longitude]="lng" [zoom]="zoom">
            <agm-marker [latitude]="lat" [longitude]="lng">
                <agm-snazzy-info-window [maxWidth]="200" [closeWhenOthersOpen]="false">
                    <ng-template>
                        My first Snazzy Info Window!
                    </ng-template>
                </agm-snazzy-info-window>
            </agm-marker>
        </agm-map>
Run Code Online (Sandbox Code Playgroud)

但是,当我运行时,出现以下错误;

./node_modules/agm-snazzy-info-window/directives/snazzy-info-window.js中的错误找不到模块:错误:无法解析“ C:\ Users \ matt \ Source”中的“ snazzy-info-window” \ Repos \ MyProject \ node_modules \ agm-snazzy-info-window \ directives'@ ./node_modules/agm-snazzy-info-window/directives/snazzy-info-window.js 88:39-74 @ ./node_modules/agm -snazzy-info-window / index.js @ ./ClientApp/app/app.shared.module.ts @ ./ClientApp/app/app.browser.module.ts @ ./ClientApp/boot.browser.ts @ multi event-source-polyfill webpack-hot-middleware / client?path = __ webpack_hmr&dynamicPublicPath = true ./ClientApp/boot.browser.ts

现在,如果我删除了时髦的信息窗口,仅显示Google Map,就可以了吗?有什么想法我在这里做错了吗?

Vad*_*hev 5

由于snazzy-info-window缺少表示对的依赖的软件包,很可能发生此错误agm-snazzy-info-window,例如,还需要安装它:

"@agm/core": "1.0.0-beta.2",
"@agm/snazzy-info-window": "1.0.0-beta.2",
"snazzy-info-window": "^1.1.0"
Run Code Online (Sandbox Code Playgroud)

另外,还snazzy-info-window需要包括npm软件包附带的一些基本样式,例如:

const nonTreeShakableModules = [
    'snazzy-info-window',
    'snazzy-info-window/dist/snazzy-info-window.css'
];
Run Code Online (Sandbox Code Playgroud)