Giter VIP home page Giter VIP logo

Comments (13)

jonataswalker avatar jonataswalker commented on August 20, 2024 3

Yup, working on it.

from ol-geocoder.

walkermatt avatar walkermatt commented on August 20, 2024 2

I think dropping support for the openlayers package in a major version is fine which leaves support for:

  1. ol package
  2. hosted build (ol.Map etc.)

In ol3-layerswitcher I'm building a UMD bundle which supports the ol package and the hosted build.

Currently the tests use the hosted build.

from ol-geocoder.

jonataswalker avatar jonataswalker commented on August 20, 2024 2

Fixed in #162. Thanks @aguynamedben @walkermatt

from ol-geocoder.

walkermatt avatar walkermatt commented on August 20, 2024 1

I've been doing some work moving the ol3-layerswitcher to use ol package, see https://github.com/walkermatt/ol3-layerswitcher/issues/69. I think all plugins are going to need to move over to the ol package shortly.

For ol-geocoder I think the change should be fairly simple; in the source import the individual classes from ol instead of openlayers then update rollup build to mark each ol class external and define globals for each similar to https://github.com/walkermatt/ol3-layerswitcher/blob/ol/rollup.config.js#L20-L28.

from ol-geocoder.

jonataswalker avatar jonataswalker commented on August 20, 2024

@niteshgoyal19 Are you able to provide a repro? Like a fiddle.

from ol-geocoder.

niteshgoyal19 avatar niteshgoyal19 commented on August 20, 2024

from ol-geocoder.

jonataswalker avatar jonataswalker commented on August 20, 2024

Sorry, don't have time to build this environment and discover what's happening.

from ol-geocoder.

aguynamedben avatar aguynamedben commented on August 20, 2024

Thanks for the time you spend working on ol-geocoder. Like @jonataswalker and @caseycesari I'm also running into this issue.

image

The stacktrace points to ./node_modules/openlayers/dist/ol.js:142. My project is attempting to use ol 4.6.4 via the modern ES2015+Webpack method linked to in the docs here. This is the only part of my project that is failing with Webpack.

I'll try to reproduce in a test repo so you can see what's going on. It seems that the ol/openlayers npm packages recommend using the ol npm package for Webpack/Bowerify/ES6 usage, but using openlayers for pre-built usage. My project is trying to use ol, and it looks like ol-geocoder depends on openlayers. Maybe there is some discrepancy with how the imports are happenings vs. the dist/ version. Ideally, I'd like none of my dependencies to use a dist/ version of OpenLayers. I want Webpack to package up the ES6 modules as needed.

@jonataswalker @caseycesari were y'all able to find any temporary workarounds?

I'll post here when I have a repo with a reproduction.

from ol-geocoder.

aguynamedben avatar aguynamedben commented on August 20, 2024

I'm curious if this issue would be fixed by depending on ol instead of openlayers, then changing the imports to the recommended ES6 way.

I.e. go from this style:

import ol from 'openlayers';

const layer = new ol.layer.Vector({
  name: layerName,
  source: new ol.source.Vector()
});

To this:

import SourceVector from 'ol/source/vector';
import LayerVector from 'ol/layer/vector';

const layer = new LayerVector({
  name: layerName,
  source: new SourceVector()
});

I'm an OpenLayers n00b, but from my read of the docs, that's how OpenLayers should be used in an ES6 environment. I think this would also not cause the dist/ import, making Webpack bundles that use ol-geocoder smaller.

Will reproduce, I'm curious what the maintainers think of that, though!

image

from ol-geocoder.

aguynamedben avatar aguynamedben commented on August 20, 2024

@jonataswalker I was able to reproduce in this small, simple repo: https://github.com/aguynamedben/ol-geocoder-152 details in the README. I'm curious what you think. Thanks for your time.

from ol-geocoder.

aguynamedben avatar aguynamedben commented on August 20, 2024

🙏 Thank you for looking at it. I'm not well-versed in OpenLayers or ol-geocoder, but I'm happy to help. I think I understand the process of moving to the ol package because I had to do it in my project.

from ol-geocoder.

jonataswalker avatar jonataswalker commented on August 20, 2024

I'm stuck and I'll need some help, @walkermatt?

There are three scenarios:

  1. ol package dependency
    • works on browser
    • works on project that depends on ol
    • doesn't work on unit tests (test:unit)
      • unit tests are done in a Node environment therefore SyntaxError: Unexpected token import
  2. no dependencies at all
    • works on browser
    • doesn't work on project that depends on ol
      • ol (used by ol-geocoder) is undefined
    • works on tests
      • unit tests are done with openlayers package
  3. openlayers package dependency
    • the reason this issue was created

from ol-geocoder.

aguynamedben avatar aguynamedben commented on August 20, 2024

@jonataswalker Any update on migrating to the ol package? I noticed some other plugins have done this now (walkermatt/ol-popup@494a42c).

Is it a matter of simply switching the imports in src/nominatim.js and src/base.js and changing the dependencies? I'm happy to take a stab at it if you think it's pretty straightforward.

from ol-geocoder.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.