[discuss] using ES6 modules
eddy-geek opened this issue · 2 comments
First, would you mind enabling github discussions? I feel bad polluting issues with stuff like this 🥲
I would like to add further dependencies to WTracks, like
Right now we just copy js files around, and they risk breaking each other because of global namespace.
Here are some ideas to make integration easier and more maintainable.
- Import dependencies ES6 Modules. This implies refactoring Wtracks own JS files to use
import
andexport
syntax. - Dependency versioning: 2 possibilities:
- Use git submodules
- Use unpkg. best perf, need to add a jsconfig.json for IDE completion, cannot patch dep like you still do for leaflet I think
- Use
npm install
+ snowpack. still heavier setup than the currentpython3 -m http.server
- Stay as is
Right now I'd advocate for (1), and maybe (ii) for new libs. I'm willing to contribute this (no timeframe though). WDYT?
Yes, it would be better to use imports. I had to patch some libs in the past, but I'm not sure if there are still some in wtracks today.
I would have to look deeper at the alternatives to identify the most appropriate, I'm not familiar with all of them. I welcome your recommendations.
I activated discussions on the repo.
...so you should be able to "Convert to discussion" with a button around here: ---->
I am not working a lot with the web, had some experience with webpack, hated it 😆
So I liked the "zero-tooling" approach you had so far, and it's especially welcoming to contributors. This is why I'd go with built-in javascript modules and see how far we can go with that and a CDN like unpkg (similar to what you have already with <script src="https://cdnjs.cloudflare.com/ajax/libs/dropbox.js/0.10.2/dropbox.min.js"></script>
).
If it's not enough, snowpack seems to have started as a push-back against older, heavier tools like webpack (according to Building without bundling / A Future Without Webpack), so might be worth a try. I've never used it.