MCPcopy Create free account
hub / github.com/claude-code-best/claude-code / rawAssetPlugin

Function rawAssetPlugin

vite.config.ts:43–62  ·  view source on GitHub ↗

* Plugin to import .md files as raw strings (Bun's text loader behavior).

(extensions: string[])

Source from the content-addressed store, hash-verified

41 * Plugin to import .md files as raw strings (Bun's text loader behavior).
42 */
43function rawAssetPlugin(extensions: string[]): Plugin {
44 return {
45 name: 'raw-asset',
46 enforce: 'pre',
47 resolveId(id, importer) {
48 if (extensions.some(ext => id.endsWith(ext))) {
49 // Resolve to actual file path
50 return this.resolve(id, importer, { skipSelf: true })
51 }
52 return null
53 },
54 load(id) {
55 if (extensions.some(ext => id.endsWith(ext))) {
56 const content = readFileSync(id, 'utf-8')
57 return `export default ${JSON.stringify(content)}`
58 }
59 return null
60 },
61 }
62}
63
64export default defineConfig({
65 // CLI tool — no browser features needed

Callers 1

vite.config.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected