feat(plugins): add support for loading ESM plugins (#2688)
Co-authored-by: Matt Travi <programmer@travi.org> Co-authored-by: Gregor Martynus <39992+gr2m@users.noreply.github.com>
This commit is contained in:
co-authored by
Gregor Martynus
parent
5df624c6e5
commit
d170f73e0b
@@ -199,7 +199,18 @@ test('loadPlugin', async (t) => {
|
||||
await loadPlugin({cwd}, './plugin-noop.cjs', {'./plugin-noop.cjs': './test/fixtures'}),
|
||||
'From a shareable config context'
|
||||
);
|
||||
t.is(func, await loadPlugin({cwd}, func, {}), 'Defined as a function');
|
||||
t.is(
|
||||
(await import("../fixtures/plugin-noop.cjs")).default,
|
||||
await loadPlugin({ cwd }, "./plugin-noop.cjs", { "./plugin-noop.cjs": "./test/fixtures" }),
|
||||
"From a shareable config context"
|
||||
);
|
||||
const { ...namedExports } = await import("../fixtures/plugin-esm-named-exports.js");
|
||||
const plugin = await loadPlugin({ cwd }, "./plugin-esm-named-exports.js", {
|
||||
"./plugin-esm-named-exports.js": "./test/fixtures",
|
||||
});
|
||||
|
||||
t.deepEqual(namedExports, plugin, "ESM with named exports");
|
||||
t.is(func, await loadPlugin({ cwd }, func, {}), "Defined as a function");
|
||||
});
|
||||
|
||||
test('parseConfig', (t) => {
|
||||
|
||||
Reference in New Issue
Block a user