I'm getting back into front-end development after several years away and am catching up on current workflows. My project uses a few libraries delivered from CDNs, including Lit and Shoelace/Web Awesome. The rest is fairly lightweight vanilla JavaScript with web components and a WebAssembly engine, so I'm not currently using a build system or bundler. Is there a modern way to make CDN-loaded scripts available during offline development, or should I download local copies and update the script tags or import map manually?
2 Answers
Use one configuration value or base URL to switch between the CDN and local files. Keep the actual imports unchanged, then choose the remote path when online and the local vendor path before travelling. This avoids editing every script reference by hand.
A package manager is another good route: install the libraries locally and either serve their distribution files from your static directory or resolve them from the package directory through a bundler. For a small no-build project, though, a local vendor folder plus a single CDN/local switch is probably the least disruptive solution.

A service worker can cache the CDN resources, but it usually adds unnecessary complexity for development. I’d only use one if the project already needs service-worker functionality.