File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
packages/vite/src/node/plugins Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -36,8 +36,8 @@ export const assetUrlRE = /__VITE_ASSET__([\w$]+)__(?:\$_(.*?)__)?/g
3636
3737const jsSourceMapRE = / \. [ c m ] ? j s \. m a p $ /
3838
39- const noInlineRE = / [ ? & ] n o - i n l i n e \b /
40- const inlineRE = / [ ? & ] i n l i n e \b /
39+ export const noInlineRE = / [ ? & ] n o - i n l i n e \b /
40+ export const inlineRE = / [ ? & ] i n l i n e \b /
4141const svgExtRE = / \. s v g (?: $ | \? ) /
4242
4343const assetCache = new WeakMap < Environment , Map < string , string > > ( )
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import { dataToEsm, makeLegalIdentifier } from '@rollup/pluginutils'
1010import { SPECIAL_QUERY_RE } from '../constants'
1111import type { Plugin } from '../plugin'
1212import { stripBomTag } from '../utils'
13+ import { inlineRE , noInlineRE } from './asset'
1314
1415export interface JsonOptions {
1516 /**
@@ -47,6 +48,14 @@ export function jsonPlugin(
4748 if ( ! jsonExtRE . test ( id ) ) return null
4849 if ( SPECIAL_QUERY_RE . test ( id ) ) return null
4950
51+ if ( ! isBuild && ( inlineRE . test ( id ) || noInlineRE . test ( id ) ) ) {
52+ this . warn (
53+ `\n` +
54+ `Using ?inline or ?no-inline for JSON imports will have no effect.\n` +
55+ `Please use ?url&inline or ?url&no-inline to control JSON file inlining behavior.\n` ,
56+ )
57+ }
58+
5059 json = stripBomTag ( json )
5160
5261 try {
You can’t perform that action at this time.
0 commit comments