Igor-Vladyka / leaflet.browser.print

A leaflet plugin which allows users to print the map directly from the browser
https://igor-vladyka.github.io/leaflet.browser.print/
MIT License
154 stars 76 forks source link

package.json missing a main key #125

Closed jude closed 1 year ago

jude commented 1 year ago

Describe the bug

require("leaflet.browser.print") is failing to find the leaflet.browser.print module.

If I add a main': 'dist/leaflet.browser.print.js key/value to package.json, the module is found.

As per https://docs.npmjs.com/cli/v9/configuring-npm/package-json#main, main defaults to index.js in the package's root folder. but there is no index.js in this module.

To Reproduce

> browserify -d src/index.js -s myproject > bundle.raw.js && uglifyjs bundle.raw.js -c -m --source-map "filename=bundle.js.map" -o bundle.js

Error: Cannot find module 'leaflet.browser.print' from '/opt/myproject/src'
    at /opt/myproject/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:46:17
...

Expected behavior

Screenshots n/a

Desktop (please complete the following information): n/a

Smartphone (please complete the following information): n/A

Additional context This is a 1 line fix that I'll submit an PR for momentarily.

Igor-Vladyka commented 1 year ago

Great, thanks.

gugudetbaba commented 8 months ago

Hello, if I install via npm, the main key is still missing in the package.json. Maybe it is just a problem on my system, nonetheless I wanted to mention it.