bundle_code() — svelte Function Reference
Architecture documentation for the bundle_code() function in check-treeshakeability.js from the svelte codebase.
Entity Profile
Dependency Diagram
graph TD 9cca0320_49c1_cecf_c508_0c6d04a737c3["bundle_code()"] a1cf3ce1_4e6b_8aaa_e102_ea18e7bc71ed["check-treeshakeability.js"] 9cca0320_49c1_cecf_c508_0c6d04a737c3 -->|defined in| a1cf3ce1_4e6b_8aaa_e102_ea18e7bc71ed style 9cca0320_49c1_cecf_c508_0c6d04a737c3 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/svelte/scripts/check-treeshakeability.js lines 12–46
async function bundle_code(entry) {
const bundle = await rollup({
input: '__entry__',
plugins: [
virtual({
__entry__: entry
}),
{
name: 'resolve-svelte',
resolveId(importee) {
if (importee.startsWith('svelte')) {
const entry = pkg.exports[importee.replace('svelte', '.')];
return path.resolve(entry.browser ?? entry.default);
}
}
},
nodeResolve({
exportConditions: ['production', 'import', 'browser', 'default']
})
],
onwarn: (warning, handle) => {
if (warning.code !== 'EMPTY_BUNDLE' && warning.code !== 'CIRCULAR_DEPENDENCY') {
handle(warning);
}
}
});
const { output } = await bundle.generate({});
if (output.length > 1) {
throw new Error('errr what');
}
return output[0].code.trim();
}
Domain
Subdomains
Source
Frequently Asked Questions
What does bundle_code() do?
bundle_code() is a function in the svelte codebase, defined in packages/svelte/scripts/check-treeshakeability.js.
Where is bundle_code() defined?
bundle_code() is defined in packages/svelte/scripts/check-treeshakeability.js at line 12.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free