-
Notifications
You must be signed in to change notification settings - Fork 2
Local web development workflow broken #254
Comments
trunk-rs/trunk#273 Not sure of the easiest path forward today. We have just 2 dependencies (leaflet and a gesture plugin). |
I'd also vote for moving away from |
Developing the app itself in rust ( If we're trying to make a fully featured and polished web app, I think we're going to end up wanting a good templating solution, some third party components, etc. Buying into some level of framework is certainly a time-efficient way of solving a whole bunch of boring problems, but of course they all have their own drawbacks. I would personally reach for React, because that is the UI paradigm I am familiar with, and I would probably reach for |
(from the other thread)
That sounds like just
|
I'm attempting this in https://github.com/a-b-street/osm2streets/tree/yarn but I suspect something is already going wrong...
|
Hmm, turns out I am using "yarn classic" 1.22. I guess I had heard about yarn modern back when it was coming out and chosen not to upgrade because it does things differently, before forgetting altogether! I'd recommend starting fresh and skipping the |
I got files downloaded locally by using But now I guess the bundler problem is next. I changed the I guess I'm still struggling to detangle the ecosystem of different options. There's a spectrum between full frameworks with scripts that auto-create all the base config, and the totally vanilla JS option using CDNs that we've done so far. We moved onto manually copying dependencies from the CDN. Now we're using a little automation to grab those packages, but they bring in way too much, and not in an immediately servable form. If you weren't using React or another full framework in one of your projects, but you grew past the point of manually copying files from a CDN, what would your vanilla JS stack be? |
I'll admit that I've only got a rudimentary understanding of the full npm and packaging ecosystem. I haven't worked on any vanilla JS projects of any size recently. One of the benefits of going the vanilla JS route is avoiding any build tooling at all. As we've just discovered npm is not suitable for a tooling-free approach. There are a bunch of different systems that have evolved that do "javascript modules" (a quick google shows CommonJS, UMD, AMD, Require.js, and Es6 module The way that vanilla JS has worked, is the CDN approach, where each dependency publishes their JS (usually minified) on their website for you to download and add to your In the modern ecosystem that approach might limit the dependencies that we have access to more than we like, and maybe we should be looking to set up a bundler and pay the cost of requiring tooling for local dev. If so, I would recommend starting choosing one of the bundler options out there and using whatever module system that expects (treating those details as implementation details that we hopefully don't have to dive into). I'm not across the current bundler landscape, but things to consider would include install/config/cli ergonomics, build features (like tree-shaking, TypeScript, custom build steps, etc.), build speed, community buy-in, ... I don't know how the choice of bundler interacts with the choice of npm vs yarn, but I prefer the ergonomics of Yarn Classic over |
trunk serve
can't be used for local development anymore. I'm getting CORS errors:Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://unpkg.com/[email protected]/dist/leaflet.js. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 301.
If I understand modern web dev best practices, the "right" answer is to instead grab local copies of our JS dependencies like leaflet and serve them. In
osm2streets
we're manually vendoring the dependencies here, but it's an unpleasant process. I manually grabbed files from unpkg, and watched browser network requests to find all of the files.Of the plethora of dependency management + bundler tools out there, what should we use? What'll play nice with trunk? Can https://trunkrs.dev/assets/#script-assets help?
The text was updated successfully, but these errors were encountered: