diff --git a/packages/plugin-vue/src/template.ts b/packages/plugin-vue/src/template.ts
index 35ab085a..7ea8a24f 100644
--- a/packages/plugin-vue/src/template.ts
+++ b/packages/plugin-vue/src/template.ts
@@ -7,7 +7,7 @@ import type {
SFCTemplateCompileResults,
} from 'vue/compiler-sfc'
import type { PluginContext, TransformPluginContext } from 'rollup'
-import { getResolvedScript } from './script'
+import { getResolvedScript, resolveScript } from './script'
import { createRollupError } from './utils/error'
import type { ResolvedOptions } from '.'
@@ -68,6 +68,7 @@ export function compile(
ssr: boolean,
) {
const filename = descriptor.filename
+ resolveScript(descriptor, options, ssr)
const result = options.compiler.compileTemplate({
...resolveTemplateCompilerOptions(descriptor, options, ssr)!,
source: code,
diff --git a/playground/vue/Main.vue b/playground/vue/Main.vue
index b91d50f9..bfcaa990 100644
--- a/playground/vue/Main.vue
+++ b/playground/vue/Main.vue
@@ -10,6 +10,7 @@
+
@@ -33,6 +34,7 @@ import Hmr from './Hmr.vue'
import HmrTsx from './HmrTsx.vue'
import Syntax from './Syntax.vue'
import PreProcessors from './PreProcessors.vue'
+import PreProcessorsHmr from './PreProcessorsHmr.vue'
import CssModules from './CssModules.vue'
import Assets from './Assets.vue'
import CustomBlock from './CustomBlock.vue'
diff --git a/playground/vue/PreProcessorsHmr.vue b/playground/vue/PreProcessorsHmr.vue
new file mode 100644
index 00000000..ccad6317
--- /dev/null
+++ b/playground/vue/PreProcessorsHmr.vue
@@ -0,0 +1,8 @@
+
+h2.pre-processors-hmr Pre-Processors Hmr
+p.pug-hmr {{ preHmr }}
+
+
+
diff --git a/playground/vue/__tests__/vue.spec.ts b/playground/vue/__tests__/vue.spec.ts
index 17a06c56..a1489c63 100644
--- a/playground/vue/__tests__/vue.spec.ts
+++ b/playground/vue/__tests__/vue.spec.ts
@@ -94,6 +94,16 @@ describe('pre-processors', () => {
)
await untilUpdated(() => getColor('p.pug-stylus'), 'orange')
})
+
+ test('pug hmr', async () => {
+ expect(await page.textContent('p.pug-hmr')).toMatch('pre-hmr')
+ editFile('PreProcessorsHmr.vue', (code) =>
+ code
+ .replace('p.pug-hmr {{ preHmr }}', 'p.pug-hmr {{ postHmr }}')
+ .replace(`const preHmr = 'pre-hmr'`, `const postHmr = 'post-hmr'`),
+ )
+ await untilUpdated(() => page.textContent('p.pug-hmr'), 'post-hmr')
+ })
})
describe('css modules', () => {