MCPcopy Create free account
hub / github.com/GregBrimble/react-server-components-workshop / getLoader

Function getLoader

utils/esbuild.ts:11–31  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

9) => (format === "cjs" ? "commonjs" : format === "esm" ? "module" : undefined);
10
11export 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
33export const defaultLoaderWithEsbuild = ({
34 build,

Callers 2

setupFunction · 0.85
setupFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected