modulePreloadPolyfill.spec.ts — vite Source File
Architecture documentation for modulePreloadPolyfill.spec.ts, a typescript file in the vite codebase. 5 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 0d441474_bd18_6871_34d1_98946e530e5a["modulePreloadPolyfill.spec.ts"] 45981d85_cbdd_e969_8c88_c17072ea0eda["build.ts"] 0d441474_bd18_6871_34d1_98946e530e5a --> 45981d85_cbdd_e969_8c88_c17072ea0eda bbded320_f805_2b6e_3109_088d194024a2["build"] 0d441474_bd18_6871_34d1_98946e530e5a --> bbded320_f805_2b6e_3109_088d194024a2 2dc11bc2_35a1_d20e_bf9f_1a3c2bbe3f85["modulePreloadPolyfill.ts"] 0d441474_bd18_6871_34d1_98946e530e5a --> 2dc11bc2_35a1_d20e_bf9f_1a3c2bbe3f85 a340ba46_b2b7_3048_3bb3_6907a74c8464["vitest"] 0d441474_bd18_6871_34d1_98946e530e5a --> a340ba46_b2b7_3048_3bb3_6907a74c8464 693ca867_249b_3e5a_0ce1_8930413b7fcd["rolldown"] 0d441474_bd18_6871_34d1_98946e530e5a --> 693ca867_249b_3e5a_0ce1_8930413b7fcd style 0d441474_bd18_6871_34d1_98946e530e5a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { describe, it } from 'vitest'
import type { ModuleFormat, RolldownOutput } from 'rolldown'
import { build } from '../../../build'
import { modulePreloadPolyfillId } from '../../../plugins/modulePreloadPolyfill'
const buildProject = ({ format = 'es' as ModuleFormat } = {}) =>
build({
logLevel: 'silent',
build: {
write: false,
rollupOptions: {
input: 'main.js',
output: {
format,
},
treeshake: {
moduleSideEffects: false,
},
},
minify: false,
},
plugins: [
{
name: 'test',
resolveId(id) {
if (id === 'main.js') {
return `\0${id}`
}
},
load(id) {
if (id === '\0main.js') {
return `import '${modulePreloadPolyfillId}'`
}
},
},
],
}) as Promise<RolldownOutput>
describe('load', () => {
it('loads modulepreload polyfill', async ({ expect }) => {
const { output } = await buildProject()
expect(output).toHaveLength(1)
expect(output[0].code).toMatchSnapshot()
})
it("doesn't load modulepreload polyfill when format is cjs", async ({
expect,
}) => {
const { output } = await buildProject({ format: 'cjs' })
expect(output).toHaveLength(1)
expect(output[0].code).toMatchSnapshot()
})
})
Domain
Subdomains
Functions
Dependencies
- build
- build.ts
- modulePreloadPolyfill.ts
- rolldown
- vitest
Source
Frequently Asked Questions
What does modulePreloadPolyfill.spec.ts do?
modulePreloadPolyfill.spec.ts is a source file in the vite codebase, written in typescript. It belongs to the ViteCore domain, ConfigEngine subdomain.
What functions are defined in modulePreloadPolyfill.spec.ts?
modulePreloadPolyfill.spec.ts defines 1 function(s): buildProject.
What does modulePreloadPolyfill.spec.ts depend on?
modulePreloadPolyfill.spec.ts imports 5 module(s): build, build.ts, modulePreloadPolyfill.ts, rolldown, vitest.
Where is modulePreloadPolyfill.spec.ts in the architecture?
modulePreloadPolyfill.spec.ts is located at packages/vite/src/node/__tests__/plugins/modulePreloadPolyfill/modulePreloadPolyfill.spec.ts (domain: ViteCore, subdomain: ConfigEngine, directory: packages/vite/src/node/__tests__/plugins/modulePreloadPolyfill).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free