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
36
36
37
37
const jsSourceMapRE = / \. [ c m ] ? j s \. m a p $ /
38
38
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 /
41
41
const svgExtRE = / \. s v g (?: $ | \? ) /
42
42
43
43
const 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'
10
10
import { SPECIAL_QUERY_RE } from '../constants'
11
11
import type { Plugin } from '../plugin'
12
12
import { stripBomTag } from '../utils'
13
+ import { inlineRE , noInlineRE } from './asset'
13
14
14
15
export interface JsonOptions {
15
16
/**
@@ -47,6 +48,14 @@ export function jsonPlugin(
47
48
if ( ! jsonExtRE . test ( id ) ) return null
48
49
if ( SPECIAL_QUERY_RE . test ( id ) ) return null
49
50
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
+
50
59
json = stripBomTag ( json )
51
60
52
61
try {
You can’t perform that action at this time.
0 commit comments