Skip to content

Commit 0037fec

Browse files
committed
chore: reduce diff
1 parent 90f1174 commit 0037fec

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

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

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -184,12 +184,9 @@ export function assetPlugin(config: ResolvedConfig): Plugin {
184184
const file = checkPublicFile(id, config) || cleanUrl(id)
185185
this.addWatchFile(file)
186186
// raw query, read file and return as string
187-
return {
188-
code: `export default ${JSON.stringify(
189-
await fsp.readFile(file, 'utf-8'),
190-
)}`,
191-
moduleType: 'js', // TODO: remove later when not needed
192-
}
187+
return `export default ${JSON.stringify(
188+
await fsp.readFile(file, 'utf-8'),
189+
)}`
193190
}
194191

195192
if (!urlRE.test(id) && !config.assetsInclude(cleanUrl(id))) {
@@ -220,7 +217,6 @@ export function assetPlugin(config: ResolvedConfig): Plugin {
220217
? 'no-treeshake'
221218
: false,
222219
meta: config.command === 'build' ? { 'vite:asset': true } : undefined,
223-
moduleType: 'js', // TODO: remove later when not needed
224220
}
225221
},
226222

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

Lines changed: 3 additions & 3 deletions
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)