| 1496 | const entirelyImportRE = |
| 1497 | /^(?:import\s*(?:"[^"\n]*[^\\\n]"|'[^'\n]*[^\\\n]');*|\/\*[\s\S]*?\*\/|\/\/.*[$\n])*$/ |
| 1498 | function 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 | |
| 1504 | function getBaseInHTML(urlRelativePath: string, config: ResolvedConfig) { |
| 1505 | // Prefer explicit URL if defined for linking to assets and public files from HTML, |