Skip to content

Commit

Permalink
fix(plugin-vue): import vue file as raw correctly (#1923)
Browse files Browse the repository at this point in the history
  • Loading branch information
CHOYSEN authored Feb 7, 2021
1 parent 64e42a1 commit 863865e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/plugin-vue/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export default function vuePlugin(rawOptions: Options = {}): Plugin {

transform(code, id, ssr = !!options.ssr) {
const { filename, query } = parseVueRequest(id)
if (!query.vue && !filter(filename)) {
if ((!query.vue && !filter(filename)) || query.raw) {
return
}

Expand Down
4 changes: 4 additions & 0 deletions packages/plugin-vue/src/utils/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export interface VueQuery {
type?: 'script' | 'template' | 'style' | 'custom'
index?: number
lang?: string
raw?: boolean
}

export function parseVueRequest(id: string) {
Expand All @@ -20,6 +21,9 @@ export function parseVueRequest(id: string) {
if (query.index != null) {
query.index = Number(query.index)
}
if (query.raw != null) {
query.raw = true
}
return {
filename,
query
Expand Down

0 comments on commit 863865e

Please sign in to comment.