Files
meteor/packages/modules-runtime/modern.js
Ben Newman bd9043db20 Prefer "main" field of package.json over "module" in legacy bundle.
https://github.com/meteor/meteor/issues/10658#issuecomment-550456095
https://github.com/meteor/meteor/issues/10658#issuecomment-551870115

As usual, changes to module resolution logic need to happen in parallel in
tools/isobuild/resolver.ts and in packages/modules-runtime. However,
thanks to the modern/legacy system, it's easy to make the modules-runtime
package behave exactly the way(s) we want in the server, modern client,
and legacy client bundles.
2019-11-08 11:15:23 -05:00

19 lines
535 B
JavaScript

meteorInstall = makeInstaller({
// On the client, make package resolution prefer the "browser" field of
// package.json over the "module" field over the "main" field.
browser: true,
mainFields: ["browser", "module", "main"],
fallback: function(id, parentId, error) {
if (id && id.startsWith('meteor/')) {
var packageName = id.split('/', 2)[1];
throw new Error(
'Cannot find package "' + packageName + '". ' +
'Try "meteor add ' + packageName + '".'
);
}
throw error;
}
});