This repository was archived by the owner on Jan 18, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ import {
1515} from '@vue/component-compiler'
1616import { Plugin } from 'rollup'
1717import * as path from 'path'
18- import { parse , SFCDescriptor } from '@vue/component-compiler-utils'
18+ import { parse , SFCDescriptor , SFCBlock } from '@vue/component-compiler-utils'
1919
2020const hash = require ( 'hash-sum' )
2121
@@ -133,8 +133,13 @@ export default function VuePlugin(opts: VuePluginOptions = {}): Plugin {
133133 const ref = parseVuePartRequest ( id )
134134 if ( ref ) {
135135 const element = resolveVuePart ( descriptors , ref )
136- if ( 'src' in element && ref . meta . type !== 'styles' ) {
137- return path . resolve ( path . dirname ( ref . filename ) , ( element as any ) . src as string )
136+ const src = ( element as SFCBlock ) . src
137+ if ( ref . meta . type !== 'styles' && typeof src === 'string' ) {
138+ if ( src . startsWith ( '.' ) ) {
139+ return path . resolve ( path . dirname ( ref . filename ) , src as string )
140+ } else {
141+ return require . resolve ( src , { paths : [ path . dirname ( ref . filename ) ] } )
142+ }
138143 }
139144
140145 return id
Original file line number Diff line number Diff line change @@ -30,10 +30,10 @@ export interface VuePartRequestCreator {
3030}
3131
3232export function createVueFilter (
33- include : string | undefined ,
34- exclude : string | undefined
33+ include : string | string [ ] = [ '*.vue' , '**/*.vue' ] ,
34+ exclude : string | string [ ] = [ ]
3535) : ( file : string ) => boolean {
36- const filter = createFilter ( include || '**/*.vue' , exclude )
36+ const filter = createFilter ( include , exclude )
3737
3838 return id => filter ( id )
3939}
You can’t perform that action at this time.
0 commit comments