[英]Open Layers with NPM and Webpack
I'm trying to import Open Layers 3 into my application using NPM and Webpack for bundling, but I am receiving the error and the map not rendering: 我正在尝试使用NPM和Webpack将Open Layers 3导入到我的应用程序中进行捆绑,但是我收到错误并且地图未呈现:
./~/openlayers/dist/ol.js Critical dependencies: 567:411-418 This seems to be a pre-built javascript file. ./~/openlayers/dist/ol.js关键依赖项:567:411-418这似乎是一个预构建的javascript文件。 Though this is possible, it's not recommended. 尽管这是可行的,但不建议这样做。 Try to require the original source to get better results. 尝试要求原始来源以获得更好的结果。 @ ./~/openlayers/dist/ol.js 567:411-418 @ ./~/openlayers/dist/ol.js 567:411-418
Importing Open Layers using: 使用以下命令导入开放层:
import ol from 'openlayers';
I've tried to use the noParse
option in in Webpack: noParse: /dist\\/ol.js/
with no luck. 我试图在noParse
中使用noParse
选项: noParse: /dist\\/ol.js/
运气。
How to use Open Layers with NPM and Webpack? 如何在NPM和Webpack中使用开放层?
Apperently I had to locate it exactly where it was: 显然,我必须将其准确定位在:
Working solution: 工作解决方案:
var Path = require("path");
noParse: [Path.join(__dirname, "node_modules/openlayers/dist/ol.js")]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.