diff --git a/vite.config.ts b/vite.config.ts index 6bd5a14..0349257 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -19,6 +19,25 @@ export default defineConfig({ if (id.endsWith('.py')) { return { code: `export default ${JSON.stringify(code)};`, map: null }; } + + if (id.endsWith('.txt')) { + if (code.startsWith('export default "data:text/plain;base64,')) { + const match = code.match(/data:text\/plain;base64,(.+?)"$/); + if (match) { + const base64Content = match[1]; + const decodedContent = Buffer.from( + base64Content, + 'base64' + ).toString('utf-8'); + return { + code: `export default ${JSON.stringify(decodedContent)};`, + map: null, + }; + } + } + return { code: `export default ${JSON.stringify(code)};`, map: null }; + } + return null; }, }, @@ -53,6 +72,7 @@ export default defineConfig({ esbuildOptions: { loader: { '.py': 'text', + '.txt': 'text', }, }, },