【问题标题】:Importing Openlayers ES2015 modules into angular-cli project将 Openlayers ES2015 模块导入 angular-cli 项目
【发布时间】:2017-02-11 17:28:55
【问题描述】:

喂,

我在使用 angular-cli 将新的 openlayers ES2015 modules 导入 Angular 项目构建时遇到问题。

到目前为止,我在 angular-cli.json 中将 openlayers 作为全局依赖项,一切正常,但现在由于 openlayers 的大小以及我实际使用的一小部分,我想切换。

我所做的是,删除对当前 openlayers 安装的所有引用,并使用npm install --save ol 安装 ol。然后,当尝试将组件中的 Map 模块导入为 import { Map } from 'ol/map'; 时,构建/服务过程会抛出错误:Cannot find module 'ol/map'

我对 webpack 和 co 还很陌生,因此希望能轻松开始使用 angular-cli。我正在使用 angular-cli beta 31。

谁能帮帮我!

感谢和问候

【问题讨论】:

标签: angular openlayers openlayers-3 angular-cli


【解决方案1】:

我遇到了同样的问题,我只是通过更改解决了它

import { Map } from 'ol/map';

到这里:

import Map from 'ol/map';

希望它有效!。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-08-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-30
    • 2021-02-26
    • 2017-02-09
    • 1970-01-01
    相关资源
    最近更新 更多