Skip to content

Commit 5366c74

Browse files
committed
🩹 Reduce imported YAML file size
1 parent d7d0005 commit 5366c74

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

tools/esbuild.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ import inlineImage from 'esbuild-plugin-inline-image'
1212
import * as fs from 'fs'
1313
import { load } from 'js-yaml'
1414
import vsCodeProblemsPatchPlugin from 'node-modules-vscode-problems-patch'
15-
import * as path from 'path'
16-
import { isAbsolute, join } from 'path'
15+
import path, { isAbsolute, join } from 'path'
1716
import { TextDecoder } from 'util'
1817
import svelteConfig from '../svelte.config.js'
1918
import assetOverridePlugin from './esbuild-plugins/assetOverride.js'
@@ -169,8 +168,8 @@ const yamlPlugin: (opts: {
169168
if (options?.transform && options.transform(parsed, args.path) !== void 0)
170169
parsed = options.transform(parsed, args.path)
171170
return {
172-
contents: JSON.stringify(parsed),
173-
loader: 'json',
171+
contents: `export default ${JSON.stringify(parsed)}`,
172+
loader: 'js',
174173
watchFiles: [args.path],
175174
}
176175
})

0 commit comments

Comments
 (0)