Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Circular dependency #5968

Open
2 tasks done
yuqianma opened this issue Dec 15, 2017 · 0 comments
Open
2 tasks done

Circular dependency #5968

yuqianma opened this issue Dec 15, 2017 · 0 comments
Labels
compatibility Cross-browser/device/environment compatibility refactoring
Projects

Comments

@yuqianma
Copy link

How to reproduce

  • Leaflet version I'm using: v1.2.0
  • Browser (with version) I'm using: chrome 63.0.3239.84
  • OS/Platform (with version) I'm using: os x
  1. Add a log to CRS.Earth.js
console.log(CRS);
  1. import crs index
<script type="module">
import * as index from '/node_modules/leaflet/src/geo/crs/index.js';
</script>

What behaviour I'm expecting and which behaviour I'm seeing

CRS should exist. However I got undefined;

Minimal example reproducing the issue

  • this example is as simple as possible
  • this example does not rely on any third party code

Using http://leafletjs.com/edit.html or any other jsfiddle-like site.


Just shift my project to ES Modules. I intend to import modules separately from Leaflet. But got some strange results. After struggled with the error, I finally found it's due to circular dependencies.

For the example above, moving CRS.Earth in crs/index.js to the first item solves the problem.
While since the doc page lists 'Modular build system' as a feature, I am not sure if that is an ideal solution.

Btw, I found this tool is useful: https://github.com/pahen/madge
The result:
image

Will you deem it a problem? Or should I import the Leaflet.js directly?

@Malvoz Malvoz added refactoring compatibility Cross-browser/device/environment compatibility labels Apr 19, 2022
@Malvoz Malvoz added this to To do in ES Modules via automation Jul 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compatibility Cross-browser/device/environment compatibility refactoring
Projects
ES Modules
  
To do
Development

Successfully merging a pull request may close this issue.

2 participants