mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Previously, when building a JavaScript bundle for the client, if a
package.json file had a string-valued "browser" field, we would replace
the value of the "main" field of the bundled package.json module with the
value of the "browser" field. This trick was important because it allowed
an npm package to have a different entry point on the client than it had
on the server.
However, that approach became inconsistent if the package.json file was
also explicitly imported as a module, because the package.json stub used
for module resolution prevented the real contents of package.json from
getting bundled, and disagreed with the original package.json module about
the value of the "main" field.
To resolve that inconsistency, it seems better to avoid modifying the
"main" field of package.json modules, and instead rely on the runtime
module system to make sense of the "browser" field, regardless of whether
the package.json module is a stub used only for module resolution or
contains the full contents of the original package.json file.
The ability to understand "browser" fields of package.json modules was
introduced in install@0.8.3:
377d1a3b51
This is potentially a backwards-incompatible change for developers using
this version of `ImportScanner` and `Resolver` who have not yet upgraded
their `modules-runtime` package to at least version 0.7.8. The solution is
to upgrade `modules-runtime`, though it would be nice to enforce that
better somehow.
30 lines
606 B
JavaScript
30 lines
606 B
JavaScript
Package.describe({
|
|
name: "modules-runtime",
|
|
version: "0.7.8",
|
|
summary: "CommonJS module system",
|
|
git: "https://github.com/benjamn/install",
|
|
documentation: "README.md"
|
|
});
|
|
|
|
Npm.depends({
|
|
install: "0.8.4"
|
|
});
|
|
|
|
Package.onUse(function(api) {
|
|
api.addFiles(".npm/package/node_modules/install/install.js", [
|
|
"client",
|
|
"server"
|
|
], {
|
|
bare: true
|
|
});
|
|
|
|
api.addFiles("modules-runtime.js");
|
|
api.export("meteorInstall");
|
|
});
|
|
|
|
Package.onTest(function(api) {
|
|
api.use("tinytest");
|
|
api.use("modules"); // Test modules-runtime via modules.
|
|
api.addFiles("modules-runtime-tests.js");
|
|
});
|