Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(plugin-vue): import vue file as raw correctly #1923

Merged
merged 1 commit into from
Feb 7, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix(plugin-vue): import vue file as raw correctly
  • Loading branch information
CHOYSEN committed Feb 7, 2021
commit e98454359313a2e8ce8ebd1021f3e7e621d179a6
2 changes: 1 addition & 1 deletion packages/plugin-vue/src/index.ts
Original file line number Diff line number Diff line change
@@ -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
}

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

export function parseVueRequest(id: string) {
@@ -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