You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to download map tiles using leaflet.offline:
npm init in an empty project directory
npm install leaflet.offline
Create index.js with import 'leaflet.offline'
Add "type": "module" to package.json
node index.js
I’m getting an error:
C:\path\to\project\node_modules\leaflet\dist\leaflet-src.js:230
var requestFn = window.requestAnimationFrame || getPrefixed('RequestAnimationFrame') || timeoutDefer;
^
ReferenceError: window is not defined
at C:\path\to\project\node_modules\leaflet\dist\leaflet-src.js:230:19
at C:\path\to\project\node_modules\leaflet\dist\leaflet-src.js:7:66
at Object.<anonymous> (C:\path\to\project\node_modules\leaflet\dist\leaflet-src.js:10:3)
at Module._compile (node:internal/modules/cjs/loader:1256:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Module._load (node:internal/modules/cjs/loader:960:12)
at Module.require (node:internal/modules/cjs/loader:1143:19)
at require (node:internal/modules/cjs/helpers:119:18)
at C:\path\to\project\node_modules\leaflet.offline\dist\bundle.js:2:85
Node.js v18.18.0
OS: Windows 10
The text was updated successfully, but these errors were encountered:
Seems you try to run on node and not in the browser?
Which file do I need to open in the browser after loading the package with npm install leaflet.offline? I only need to download and save the map tiles on my PC.
I want to download map tiles using leaflet.offline:
npm init
in an empty project directorynpm install leaflet.offline
index.js
withimport 'leaflet.offline'
"type": "module"
topackage.json
node index.js
I’m getting an error:
OS: Windows 10
The text was updated successfully, but these errors were encountered: