Skip to content
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

changed var-name async to isAsync #4909

Merged
merged 1 commit into from Dec 6, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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