File tree Expand file tree Collapse file tree
packages/vite/src/node/plugins Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ export function dataURIPlugin(): Plugin {
2222 } ,
2323
2424 resolveId ( id ) {
25- if ( ! dataUriRE . test ( id ) ) {
25+ if ( ! id . trimStart ( ) . startsWith ( 'data:' ) ) {
2626 return
2727 }
2828
Original file line number Diff line number Diff line change 11< div class ="plain "> </ div >
22< div class ="base64 "> </ div >
3+ < div class ="comma "> </ div >
34
45< script type ="module ">
56 import msg from "data:text/javascript, export default 'hi'"
89 import base64Msg from 'data:text/javascript;base64, ZXhwb3J0IGRlZmF1bHQgJ2hpJw=='
910 text ( '.base64' , base64Msg )
1011
12+ import { comma } from 'comma/foo?number=1,2,3'
13+ text ( '.comma' , comma )
14+
1115 function text ( el , text ) {
1216 document . querySelector ( el ) . textContent = text
1317 }
Original file line number Diff line number Diff line change 1+ import { defineConfig } from 'vite'
2+
3+ export default defineConfig ( {
4+ plugins : [
5+ {
6+ name : 'post-plugin' ,
7+ enforce : 'post' ,
8+ resolveId ( id ) {
9+ if ( id . replace ( / \? .* $ / , '' ) === 'comma/foo' ) {
10+ return id
11+ }
12+ } ,
13+ load ( id ) {
14+ if ( id . replace ( / \? .* $ / , '' ) === 'comma/foo' ) {
15+ return `export const comma = 'hi'`
16+ }
17+ } ,
18+ } ,
19+ ] ,
20+ } )
You can’t perform that action at this time.
0 commit comments