Cannot use this package with nextjs
Opened this issue · 1 comments
THRY commented
Hi, im trying to use this package within nextjs and i get an error.
I am installing the package like described in the FAQ-Section (How can I import this library as ES module?):
const controlElevation = L.control.elevation({srcFolder: '/leaflet-elevation/src/' }).addTo(map);
Where the path in srcFolder points to the public nextjs folder, where i copied the package into.
I still get this error:
client.ts:59 ./node_modules/@raruto/leaflet-elevation/src/control.js:229:32
Module not found
227 | case this.__LHOTLINE: condition = typeof L.Hotline !== 'function'; break;
228 | }
> 229 | return condition !== false ? import(_.resolveURL(src, this.options.srcFolder)) : Promise.resolve();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
230 | },
231 |
232 | /**
Can you help me?
Raruto commented
Hi @THRY, I don't use leaflet with JS bundlers (it almost seems like a contradiction to me...).
Did you search among closed discussions? (it's quite an old / recurring topic).
To simplify, you can import all the necessary modules where you may need them, eg: #280 (comment)
👋 Raruto