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

Function transform

playground/transform-plugin/vite.config.js:15–27  ·  view source on GitHub ↗
(code, id)

Source from the content-addressed store, hash-verified

13 }
14 },
15 transform(code, id) {
16 if (id === file) {
17 // Ensure `index.js` is reevaluated if 'plugin-dep.js' is changed
18 this.addWatchFile('./plugin-dep.js')
19
20 return `
21 // Inject TRANSFORM_COUNT
22 let TRANSFORM_COUNT = ${transformCount++};
23
24 ${code}
25 `
26 }
27 },
28}
29
30const moduleTypePlugins = [

Callers

nothing calls this directly

Calls 1

addWatchFileMethod · 0.45

Tested by

no test coverage detected