Skip to content

Commit

Permalink
refactor: changed var async to isAsync (#4909)
Browse files Browse the repository at this point in the history
`async` is a javascript keyword, so I suggest this variable name will be less prone to error and confusing.
  • Loading branch information
ikmrgrv authored and sodatea committed Dec 6, 2019
1 parent 6c24964 commit aeddc6f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/@vue/cli-service/lib/commands/build/resolveWcEntry.js
Expand Up @@ -16,12 +16,12 @@ const hyphenate = str => {
* @param {string} prefix The prefix for the component library
* @param {string} component The component name for single entry builds, component file for multi-entry builds
* @param {string} file The file for the component
* @param {boolean} async Whether to load component async or not
* @param {boolean} isAsync Whether to load component async or not
*/
const createElement = (prefix, component, file, async) => {
const createElement = (prefix, component, file, isAsync) => {
const { camelName, kebabName } = exports.fileToComponentName(prefix, component)

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

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

const content = `
import './setPublicPath'
Expand Down

0 comments on commit aeddc6f

Please sign in to comment.