From 0330bb13d12dccbd03a66e18dcb1d4adbf20d523 Mon Sep 17 00:00:00 2001 From: sapphi-red <49056869+sapphi-red@users.noreply.github.com> Date: Mon, 18 Nov 2024 20:19:54 +0900 Subject: [PATCH] chore: reduce diff --- packages/vite/src/node/plugins/asset.ts | 10 +++------- packages/vite/src/node/plugins/json.ts | 6 +++--- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/packages/vite/src/node/plugins/asset.ts b/packages/vite/src/node/plugins/asset.ts index 92788acd5126c2..4146ee90d98aef 100644 --- a/packages/vite/src/node/plugins/asset.ts +++ b/packages/vite/src/node/plugins/asset.ts @@ -180,12 +180,9 @@ export function assetPlugin(config: ResolvedConfig): Plugin { const file = checkPublicFile(id, config) || cleanUrl(id) this.addWatchFile(file) // raw query, read file and return as string - return { - code: `export default ${JSON.stringify( - await fsp.readFile(file, 'utf-8'), - )}`, - moduleType: 'js', // TODO: remove later when not needed - } + return `export default ${JSON.stringify( + await fsp.readFile(file, 'utf-8'), + )}` } if (!urlRE.test(id) && !config.assetsInclude(cleanUrl(id))) { @@ -216,7 +213,6 @@ export function assetPlugin(config: ResolvedConfig): Plugin { ? 'no-treeshake' : false, meta: config.command === 'build' ? { 'vite:asset': true } : undefined, - moduleType: 'js', // TODO: remove later when not needed } }, diff --git a/packages/vite/src/node/plugins/json.ts b/packages/vite/src/node/plugins/json.ts index 0d9ec79d39efce..d45026e17cc5ca 100644 --- a/packages/vite/src/node/plugins/json.ts +++ b/packages/vite/src/node/plugins/json.ts @@ -71,7 +71,7 @@ export function jsonPlugin( return { code, map: { mappings: '' }, - moduleType: 'js', // TODO: remove later when not needed + moduleType: 'js', } } @@ -90,7 +90,7 @@ export function jsonPlugin( return { code: `export default JSON.parse(${JSON.stringify(json)})`, map: { mappings: '' }, - moduleType: 'js', // TODO: remove later when not needed + moduleType: 'js', } } } @@ -101,7 +101,7 @@ export function jsonPlugin( namedExports: options.namedExports, }), map: { mappings: '' }, - moduleType: 'js', // TODO: remove later when not needed + moduleType: 'js', } } catch (e) { const position = extractJsonErrorPosition(e.message, json.length)