Skip to content

"const">"var" #1893

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

Closed
wants to merge 1 commit into from
Closed
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
8 changes: 4 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export default function loader(
const propsToAttach: [string, string][] = []

// script
let scriptImport = `const script = {}`
let scriptImport = `var script = {}`
let isTS = false
const { script, scriptSetup } = descriptor
if (script || scriptSetup) {
Expand Down Expand Up @@ -210,7 +210,7 @@ export default function loader(
)
}
if (!hasCSSModules) {
stylesCode += `\nconst cssModules = {}`
stylesCode += `\nvar cssModules = {}`
propsToAttach.push([`__cssModules`, `cssModules`])
hasCSSModules = true
}
Expand Down Expand Up @@ -284,10 +284,10 @@ export default function loader(

// finalize
if (!propsToAttach.length) {
code += `\n\nconst __exports__ = script;`
code += `\n\nvar __exports__ = script;`
} else {
code += `\n\nimport exportComponent from ${exportHelperPath}`
code += `\nconst __exports__ = /*#__PURE__*/exportComponent(script, [${propsToAttach
code += `\nvar __exports__ = /*#__PURE__*/exportComponent(script, [${propsToAttach
.map(([key, val]) => `['${key}',${val}]`)
.join(',')}])`
}
Expand Down