mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
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.
55 lines
1.4 KiB
JavaScript
55 lines
1.4 KiB
JavaScript
import assert from "assert";
|
|
import "regenerator-runtime/runtime";
|
|
export const ModulesTestPackage = "loaded";
|
|
|
|
import { parse } from "acorn";
|
|
assert.strictEqual(typeof parse, "function");
|
|
|
|
// Test that an npm package with a "module" entry point in its package.json
|
|
// file can be imported.
|
|
import { Slot } from "@wry/context";
|
|
assert.strictEqual(typeof Slot, "function");
|
|
const idPrefix = "/node_modules/meteor/modules-test-package/node_modules/@wry/context/lib/";
|
|
assert.strictEqual(
|
|
require.resolve("@wry/context"),
|
|
idPrefix + (
|
|
Meteor.isClient && Meteor.isModern ? "context.esm.js" : "context.js"
|
|
),
|
|
);
|
|
|
|
import ganalytics from "ganalytics";
|
|
assert.strictEqual(typeof ganalytics, "function");
|
|
|
|
export function checkWhere(where) {
|
|
const { where: serverWhere } = require("./server/where.js");
|
|
const { where: clientWhere } = require("./client/where.js");
|
|
assert.strictEqual(serverWhere, where);
|
|
assert.strictEqual(clientWhere, where);
|
|
}
|
|
|
|
export function checkPackageVars() {
|
|
if (Meteor.isClient) {
|
|
assert.strictEqual(ClientPackageVar, "client");
|
|
try {
|
|
console.log(ServerPackageVar);
|
|
} catch (e) {
|
|
if (e instanceof ReferenceError) {
|
|
// ok
|
|
} else {
|
|
throw e;
|
|
}
|
|
}
|
|
} else {
|
|
assert.strictEqual(ServerPackageVar, "server");
|
|
try {
|
|
console.log(ClientPackageVar);
|
|
} catch (e) {
|
|
if (e instanceof ReferenceError) {
|
|
// ok
|
|
} else {
|
|
throw e;
|
|
}
|
|
}
|
|
}
|
|
}
|