Skip to content

Commit 0330bb1

Browse files
committed
chore: reduce diff
1 parent 9afe273 commit 0330bb1

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

packages/vite/src/node/plugins/asset.ts

+3-7
Original file line numberDiff line numberDiff line change
@@ -180,12 +180,9 @@ export function assetPlugin(config: ResolvedConfig): Plugin {
180180
const file = checkPublicFile(id, config) || cleanUrl(id)
181181
this.addWatchFile(file)
182182
// raw query, read file and return as string
183-
return {
184-
code: `export default ${JSON.stringify(
185-
await fsp.readFile(file, 'utf-8'),
186-
)}`,
187-
moduleType: 'js', // TODO: remove later when not needed
188-
}
183+
return `export default ${JSON.stringify(
184+
await fsp.readFile(file, 'utf-8'),
185+
)}`
189186
}
190187

191188
if (!urlRE.test(id) && !config.assetsInclude(cleanUrl(id))) {
@@ -216,7 +213,6 @@ export function assetPlugin(config: ResolvedConfig): Plugin {
216213
? 'no-treeshake'
217214
: false,
218215
meta: config.command === 'build' ? { 'vite:asset': true } : undefined,
219-
moduleType: 'js', // TODO: remove later when not needed
220216
}
221217
},
222218

packages/vite/src/node/plugins/json.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export function jsonPlugin(
7171
return {
7272
code,
7373
map: { mappings: '' },
74-
moduleType: 'js', // TODO: remove later when not needed
74+
moduleType: 'js',
7575
}
7676
}
7777

@@ -90,7 +90,7 @@ export function jsonPlugin(
9090
return {
9191
code: `export default JSON.parse(${JSON.stringify(json)})`,
9292
map: { mappings: '' },
93-
moduleType: 'js', // TODO: remove later when not needed
93+
moduleType: 'js',
9494
}
9595
}
9696
}
@@ -101,7 +101,7 @@ export function jsonPlugin(
101101
namedExports: options.namedExports,
102102
}),
103103
map: { mappings: '' },
104-
moduleType: 'js', // TODO: remove later when not needed
104+
moduleType: 'js',
105105
}
106106
} catch (e) {
107107
const position = extractJsonErrorPosition(e.message, json.length)

0 commit comments

Comments
 (0)