mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-15 15:52:21 +00:00
build: name the lazy Navara engine chunk navara-engine
chunkFileNames names the chunk holding src/globe/navara navara-engine-[hash].js; chunking is unchanged (manualChunks would pull modules shared with the Cesium entry into it and make the entry import it). The Cesium main chunk stays 2,849,217 B.
This commit is contained in:
1 parent
64d3297301
commit
8270172086
3 files changed
+56
-2
No files matched your search
@@ -54,3 +54,33 @@ test('the browser build runs the Navara asset copy as a Rollup plugin', () => {
|
||||
);
|
||||
assert.equal(build.chunkSizeWarningLimit, 1500);
|
||||
});
|
||||
|
||||
test('the lazy chunk with the Navara engine is named navara-engine', async () => {
|
||||
const { navaraChunkFileNames } = await import('../../build/navaraAssets.js');
|
||||
for (const ids of [
|
||||
['/repo/src/globe/navara/index.js', '/repo/src/globe/navara/maps.js'],
|
||||
[
|
||||
'/repo/node_modules/@navaramap/three/dist/index.js',
|
||||
'/repo/src/globe/navara/index.js',
|
||||
],
|
||||
])
|
||||
assert.equal(
|
||||
navaraChunkFileNames({ isEntry: false, moduleIds: ids }),
|
||||
'assets/navara-engine-[hash].js',
|
||||
);
|
||||
for (const chunk of [
|
||||
{ isEntry: false, moduleIds: ['/repo/src/app/navaraMode.js'] },
|
||||
{ isEntry: false, moduleIds: ['/repo/src/globe/contract.js'] },
|
||||
// A package chunk split off by the bundler keeps its own name.
|
||||
{
|
||||
isEntry: false,
|
||||
moduleIds: ['/repo/node_modules/@navaramap/three/dist/spark.js'],
|
||||
},
|
||||
{ isEntry: true, moduleIds: ['/repo/src/globe/navara/index.js'] },
|
||||
{ isEntry: false },
|
||||
])
|
||||
assert.equal(navaraChunkFileNames(chunk), 'assets/[name]-[hash].js');
|
||||
const { build } = createBrowserViteConfig({});
|
||||
assert.equal(build.rollupOptions.output.chunkFileNames, navaraChunkFileNames);
|
||||
assert.equal(build.rollupOptions.output.manualChunks, undefined);
|
||||
});
|
||||
Reference in new issue
Block a user