From d48e4b81fc6d918c832c82e9812375b75ea79745 Mon Sep 17 00:00:00 2001 From: Rahul Kadyan Date: Sat, 26 May 2018 00:18:28 +0530 Subject: [PATCH 1/2] fix: Add *.vue to include patterns --- src/utils.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utils.ts b/src/utils.ts index f7994a8..7a3a9ca 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -30,10 +30,10 @@ export interface VuePartRequestCreator { } export function createVueFilter( - include: string | undefined, - exclude: string | undefined + include: string | string[] = ['*.vue', '**/*.vue'], + exclude: string | string[] = [] ): (file: string) => boolean { - const filter = createFilter(include || '**/*.vue', exclude) + const filter = createFilter(include, exclude) return id => filter(id) } From cd6793f0769695682c336b09ad251015870c4814 Mon Sep 17 00:00:00 2001 From: Rahul Kadyan Date: Sat, 26 May 2018 00:24:30 +0530 Subject: [PATCH 2/2] fix: Resolve src attr values on custom block --- src/index.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/index.ts b/src/index.ts index 7b93bb6..5f997b3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -15,7 +15,7 @@ import { } from '@vue/component-compiler' import {Plugin} from 'rollup' import * as path from 'path' -import {parse, SFCDescriptor} from '@vue/component-compiler-utils' +import {parse, SFCDescriptor, SFCBlock} from '@vue/component-compiler-utils' const hash = require('hash-sum') @@ -133,8 +133,13 @@ export default function VuePlugin(opts: VuePluginOptions = {}): Plugin { const ref = parseVuePartRequest(id) if (ref) { const element = resolveVuePart(descriptors, ref) - if ('src' in element && ref.meta.type !== 'styles') { - return path.resolve(path.dirname(ref.filename), (element as any).src as string) + const src = (element as SFCBlock).src + if (ref.meta.type !== 'styles' && typeof src === 'string') { + if (src.startsWith('.')) { + return path.resolve(path.dirname(ref.filename), src as string) + } else { + return require.resolve(src, { paths: [path.dirname(ref.filename)] }) + } } return id