Closed claustres closed 3 months ago
I made some research and it seems that the best thing to do is to specify file extension at the source level (ie TypeScript) otherwise you have to use the kind of hacking tool I used like babel plugins or so.
Can you create and share a minimal WebPack example that reproduces your problem without TypeScript?
Probably not so easy but I can first share the setup of our application, which is based on Quasar Webpack support.
We're likely going to migrate the build scripts to https://github.com/egoist/tsup which should improve the CommonJS situation, and also stop using default exports.
Can you please try 4.0.0-alpha.0
It seems to work fine now @bdon, thanks. Let me know when you plan to release a fix.
This major release will also move from bundled ESM modules/CJS to unbundled, which is what people expect for ES6 frontend and NodeJS projects. Waiting on https://github.com/protomaps/protomaps-leaflet/issues/162#issuecomment-2250641439 to see that there is a workable resolution for ESM-in-the-browser.
v4.0.0 released: https://www.npmjs.com/package/protomaps-leaflet
Switching from v1 to v3 in an app using WebPack but without using TS I struggled with import errors like this:
It appears that the missing
.js
extension of the import statements in thedist
folder get WebPack messy. Just to confirm the issue I used https://github.com/beenotung/fix-esm-import-path to fix it like thisfix-esm-import-path node_modules/protomaps-leaflet/dist/index.js
. However, I am not a TS gourou so I guess there is a compile option to do so as it would ease integration.