mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Supporting "module" in package.json for server code is not advisable because Node.js will be adopting the "type":"module" convention instead, and in the meantime we need to maintain consistency with Node's module resolution rules, which only currently pay attention to "main": https://medium.com/@nodejs/announcing-a-new-experimental-modules-1be8d2d6c2ff
19 lines
535 B
JavaScript
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;
|
|
}
|
|
});
|