Skip to content

Commit 7137294

Browse files
committed
feat: pass on compilerOptions and refSugar when using <script setup>
1 parent 65c9110 commit 7137294

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

example/ScriptSetup.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
import { ref } from 'vue'
1212
import Button from './Button.vue'
1313
14-
const count = ref(0)
14+
ref: count = 100
1515
1616
function inc() {
17-
count.value++
17+
count++
1818
}
1919
2020
const hello = 'hi from scriptttt'

example/webpack.config.js

+3
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ module.exports = (env = {}) => {
5353
{
5454
test: /\.vue$/,
5555
loader: 'vue-loader',
56+
options: {
57+
refSugar: true,
58+
},
5659
},
5760
{
5861
test: /\.png$/,

src/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export interface VueLoaderOptions {
4040
transformAssetUrls?: SFCTemplateCompileOptions['transformAssetUrls']
4141
compiler?: TemplateCompiler | string
4242
compilerOptions?: CompilerOptions
43+
refSugar?: boolean
4344
hotReload?: boolean
4445
exposeFilename?: boolean
4546
appendExtension?: boolean

src/resolveScript.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,12 @@ export function resolveScript(
5757
id: scopeId,
5858
isProd,
5959
inlineTemplate: enableInline,
60+
refSugar: options.refSugar,
6061
babelParserPlugins: options.babelParserPlugins,
6162
templateOptions: {
62-
compiler,
6363
ssr: isServer,
64+
compiler,
65+
compilerOptions: options.compilerOptions,
6466
transformAssetUrls: options.transformAssetUrls || true,
6567
},
6668
})

0 commit comments

Comments
 (0)