Open wavto opened 6 years ago
Any updates on this? Or anyone who knows a workaround?
We added the following to our package.json
"scripts": {
"//": "Workaround to prevent an annoying, wrongly printed meteor warning",
"postinstall": "meteor node -e \"fs.existsSync('./node_modules/jquery') || fs.mkdirSync('./node_modules/jquery');\"",
@wavto: Clever! That works!
This feature request is a follow up of the bug report https://github.com/meteor/meteor/issues/9285.
Problem Description
I added the npm package
bootstrap-slider
to our Meteor project, which has an optional dependency to jQuery. That means the package callsrequire("jquery")
in an if statement, at some point.Since we do not use jQuery in our project, I got the following warning every time the Meteor server restarts:
As @benjamn described here the Meteor
ImportScanner
statically searches forrequire(<string literal>)
in the code base, without evaluating if that code is ever executed.This issue affects all packages requiring optional dependencies. For example, that means all packages build on top of this jQuery plugin "boilerplate", like
bootstrap-slider
in my actual case.Change Proposal
I would add an option somewhere to be able to list "known missing modules". These modules should then be ignored by the
ImportScanner
or at least they should be considered before printing the warning. This way the annoying warning printed after every restart of the Meteor server will disappear.The "known missing modules" option may be integrated into the
package.json
file or added to the run and build commands as an argument likemeteor run --ignored-modules="foo, bar"
.