如何使用包裹在多个文件中使用openlayer的“导入”功能?

问题描述

我已经使用ol 6.4.3生成了地图。我已经使用npm和包裹捆绑包安装了ol。我的package.json是

  "name": "gis","version": "1.0.0","description": "","main": "map.js","scripts": {
    "test": "echo \"Error: no test specified\" && exit 1","start": "parcel map.js","build": "parcel build --public-url . map*.js"
  },"author": "User123","license": "ISC","dependencies": {
    "ol": "^6.4.3","ol-layerswitcher": "^3.6.0","ol-popup": "^4.0.0","proj4": "^2.6.2"
  },"devDependencies": {
    "parcel-bundler": "^1.12.4"
  }
}

我可以在 map.js 文件中使用openlayer的所有“ 导入”功能。现在,我想在另一个文件 tools.js 中使用导入。但出现错误,我无法导入。我应该如何配置 package.json 以便导入另一个或多个js文件。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)