Vue version
3.4.21
Link to minimal reproduction
No
Steps to reproduce
import { compileScript, parse } from "vue/compiler-sfc";
const { descriptor } = parse(`<script setup lang="ts">
console.log(1);
</script>`);
const result = compileScript(descriptor, {
id: descriptor.filename,
templateOptions: {
compilerOptions: {
runtimeModuleName: "npm:vue",
},
},
});
console.log(result.content);
What is expected?
The output will be overwritten with the specified specifier.
What is actually happening?
The output will look like this:
import { defineComponent as _defineComponent } from 'vue'
export default /*#__PURE__*/_defineComponent({
setup(__props, { expose: __expose }) {
__expose();
console.log(1);
...
System Info
No response
Any additional comments?
Perhaps the following code needs to be modified:
|
ctx.s.prepend( |
|
`import { ${[...ctx.helperImports] |
|
.map(h => `${h} as _${h}`) |
|
.join(', ')} } from 'vue'\n`, |
Vue version
3.4.21
Link to minimal reproduction
No
Steps to reproduce
What is expected?
The output will be overwritten with the specified specifier.
What is actually happening?
The output will look like this:
System Info
No response
Any additional comments?
Perhaps the following code needs to be modified:
core/packages/compiler-sfc/src/compileScript.ts
Lines 992 to 995 in f66a75e