File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed
packages/instrument-bundler/src Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,20 @@ export const plugin = (options: { inputs: BundlerInput[] }): Plugin => {
2929 path : args . path
3030 } ;
3131 } ) ;
32+ build . onLoad ( { filter : / .+ \? r a w $ / , namespace : namespaces . bundle } , ( args ) => {
33+ const input = resolveInput ( / ( .+ ) \? r a w $ / . exec ( args . path ) ! [ 1 ] ! , options . inputs ) ;
34+ if ( ! input ) {
35+ return {
36+ errors : [
37+ {
38+ location : { file : args . path } ,
39+ text : `Failed to resolve '${ args . path } ' from input filenames: ${ options . inputs . map ( ( file ) => `'${ file . name } '` ) . join ( ', ' ) } `
40+ }
41+ ]
42+ } ;
43+ }
44+ return { contents : input ?. content , loader : 'text' } ;
45+ } ) ;
3246 build . onLoad ( { filter : / ^ \/ r u n t i m e \/ v 1 \/ .* .c s s $ / , namespace : namespaces . bundle } , ( args ) => {
3347 return { contents : `@import "${ args . path } ";` , loader : 'css' } ;
3448 } ) ;
Original file line number Diff line number Diff line change @@ -44,3 +44,8 @@ declare module '*.json' {
4444 const src : any ;
4545 export default src ;
4646}
47+
48+ declare module '*?raw' {
49+ const src : string ;
50+ export default src ;
51+ }
You can’t perform that action at this time.
0 commit comments