Skip to content

Commit aeddc6f

Browse files
quriosapienhaoqunjiang
authored andcommitted
refactor: changed var async to isAsync (#4909)
`async` is a javascript keyword, so I suggest this variable name will be less prone to error and confusing.
1 parent 6c24964 commit aeddc6f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

packages/@vue/cli-service/lib/commands/build/resolveWcEntry.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ const hyphenate = str => {
1616
* @param {string} prefix The prefix for the component library
1717
* @param {string} component The component name for single entry builds, component file for multi-entry builds
1818
* @param {string} file The file for the component
19-
* @param {boolean} async Whether to load component async or not
19+
* @param {boolean} isAsync Whether to load component async or not
2020
*/
21-
const createElement = (prefix, component, file, async) => {
21+
const createElement = (prefix, component, file, isAsync) => {
2222
const { camelName, kebabName } = exports.fileToComponentName(prefix, component)
2323

24-
return async
24+
return isAsync
2525
? `window.customElements.define('${kebabName}', wrap(Vue, () => import('~root/${file}?shadow')))\n`
2626
: `import ${camelName} from '~root/${file}?shadow'\n` +
2727
`window.customElements.define('${kebabName}', wrap(Vue, ${camelName}))\n`
@@ -38,12 +38,12 @@ exports.fileToComponentName = (prefix, file) => {
3838
}
3939
}
4040

41-
exports.resolveEntry = (prefix, libName, files, async) => {
41+
exports.resolveEntry = (prefix, libName, files, isAsync) => {
4242
const filePath = path.resolve(__dirname, 'entry-wc.js')
4343
const elements =
4444
prefix === ''
4545
? [createElement('', libName, files[0])]
46-
: files.map(file => createElement(prefix, file, file, async)).join('\n')
46+
: files.map(file => createElement(prefix, file, file, isAsync)).join('\n')
4747

4848
const content = `
4949
import './setPublicPath'

0 commit comments

Comments
 (0)