Closed jude closed 1 year ago
Describe the bug
require("leaflet.browser.print") is failing to find the leaflet.browser.print module.
require("leaflet.browser.print")
If I add a main': 'dist/leaflet.browser.print.js key/value to package.json, the module is found.
main': 'dist/leaflet.browser.print.js
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
require('package.browser.print')
> 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.
Great, thanks.
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.
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
require('package.browser.print')
line in your project's index.js fileExpected 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.