MCPcopy
hub / github.com/vitejs/vite / isEntirelyImport

Function isEntirelyImport

packages/vite/src/node/plugins/html.ts:1498–1502  ·  view source on GitHub ↗
(code: string)

Source from the content-addressed store, hash-verified

1496const entirelyImportRE =
1497 /^(?:import\s*(?:"[^"\n]*[^\\\n]"|'[^'\n]*[^\\\n]');*|\/\*[\s\S]*?\*\/|\/\/.*[$\n])*$/
1498function isEntirelyImport(code: string) {
1499 // only consider "side-effect" imports, which match <script type=module> semantics exactly
1500 // the regexes will remove too little in some exotic cases, but false-negatives are alright
1501 return entirelyImportRE.test(code.trim())
1502}
1503
1504function getBaseInHTML(urlRelativePath: string, config: ResolvedConfig) {
1505 // Prefer explicit URL if defined for linking to assets and public files from HTML,

Callers 1

generateBundleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected