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 have a package that can be extended by users with their plugins. Obviously my package can't list all plugins as peers. Users specify only package names and my package requires them. Now we're getting module not found errors.
If your package is something that automatically loads plugins (for example eslint), peer dependencies obviously aren't an option as you can't reasonably list all plugins. Instead, you should use the createRequire function (or its polyfill) to load plugins on behalf of the configuration file that lists the plugins to load - be it the package.json or a custom one like the .eslintrc.js file.
However the solution is still not clear to me. As far as I understood this paragraph is make users import all those plugins right in the config (?) and pass modules themselves, not module names/paths in the config. However we already have public API where users specify names/paths that has been working for years, with other package managers. Plus, I don't understand how anything can be imported inside/on behalf of the user's package.json.
I would greatly appreciate if you could elaborate the paragraph above and provide some examples how this can be done.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have a package that can be extended by users with their plugins. Obviously my package can't list all plugins as peers. Users specify only package names and my package
require
s them. Now we're getting module not found errors.I've found a few words on the matter here:
However the solution is still not clear to me. As far as I understood this paragraph is make users import all those plugins right in the config (?) and pass modules themselves, not module names/paths in the config. However we already have public API where users specify names/paths that has been working for years, with other package managers. Plus, I don't understand how anything can be imported inside/on behalf of the user's
package.json
.I would greatly appreciate if you could elaborate the paragraph above and provide some examples how this can be done.
Beta Was this translation helpful? Give feedback.
All reactions