Supporting multri entry

This commit is contained in:
2023-05-02 05:05:42 +02:00
parent 4006f3954e
commit 9768b3efe5
10 changed files with 193 additions and 13 deletions

40
test/multi-entry/test.js Normal file
View File

@@ -0,0 +1,40 @@
import {join, dirname} from "node:path";
import test from "ava";
import { rollup } from "rollup";
import {debugPrintOutput, getCode} from "../util/test.js";
import html from "../../src/index.ts";
const output = {
dir: 'output', // Output all files
format: 'es', // iifi and cjs should be added to tests
sourcemap: true,// Test if #sourcemapUrl is not accidentally included in the html-output
};
import {fileURLToPath} from "node:url";
const __dirname = dirname(fileURLToPath(import.meta.url));
process.chdir(join(__dirname, 'fixtures'));
test.serial('multi-entry', async (t) => {
const bundle = await rollup({
input: {
['index']: 'index.html',
['admin/index']: 'admin/index.html'
},
plugins: [
html({
}),
]
});
const code = await getCode(bundle, output, true);
debugPrintOutput('multi-entry',code);
t.snapshot(code);
});
// TODO various parameters
// - format: cjs, iifi, ...
// - sourcemap: inline, false, (and the various exotic sourcemap options)
// Watch mode tests would be its own dir
// ...