| 9 | ) => (format === "cjs" ? "commonjs" : format === "esm" ? "module" : undefined); |
| 10 | |
| 11 | export const getLoader = (path: string) => |
| 12 | path.endsWith(".js") || path.endsWith(".cjs") || path.endsWith(".mjs") |
| 13 | ? "js" |
| 14 | : path.endsWith(".ts") || |
| 15 | path.endsWith(".tsx") || |
| 16 | path.endsWith(".mts") || |
| 17 | path.endsWith(".cts") |
| 18 | ? "tsx" |
| 19 | : path.endsWith(".jsx") |
| 20 | ? "jsx" |
| 21 | : path.endsWith(".tsx") |
| 22 | ? "tsx" |
| 23 | : path.endsWith(".json") |
| 24 | ? "json" |
| 25 | : path.endsWith(".module.css") |
| 26 | ? "local-css" |
| 27 | : path.endsWith(".css") |
| 28 | ? "css" |
| 29 | : path.endsWith(".txt") |
| 30 | ? "text" |
| 31 | : undefined; |
| 32 | |
| 33 | export const defaultLoaderWithEsbuild = ({ |
| 34 | build, |