File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import * as esbuild from "esbuild";
22import * as path from "path" ;
33import * as fs from 'fs' ;
44import * as crypto from "crypto" ;
5+ import { pathToFileURL } from 'url' ;
56
67import ts from "typescript" ;
78
@@ -271,19 +272,19 @@ const vuePlugin = (opts: Options = {}) => <esbuild.Plugin>{
271272 includePaths : [
272273 path . dirname ( args . path )
273274 ] ,
274- importer : [
275- ( url : string ) => {
275+ importer : {
276+ findFileUrl ( url : string ) {
276277 const projectRoot = process . env . npm_config_local_prefix || process . cwd ( )
277- const modulePath = path . join ( projectRoot , "node_modules" , url ) ;
278+ const modulePath = path . join ( projectRoot , "node_modules" , url )
278279
279- if ( fs . existsSync ( modulePath ) ) {
280- return { file : modulePath }
281- }
280+ if ( fs . existsSync ( modulePath ) ) return pathToFileURL ( modulePath )
281+
282+ const replacedPath = replaceRules ( url ) ;
283+ if ( fs . existsSync ( replacedPath ) ) return pathToFileURL ( replacedPath )
282284
283285 return null
284286 } ,
285- ( url : string ) => ( { file : replaceRules ( url ) } )
286- ]
287+ } ,
287288 } , opts . preprocessorOptions ) ,
288289 scoped : style . scoped ,
289290 } ) ;
You can’t perform that action at this time.
0 commit comments