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

--name must contain a hyphen when building a single web component. #2024

Closed
crazyNoah opened this issue Aug 1, 2018 · 2 comments
Closed

Comments

@crazyNoah
Copy link

IMPORTANT: Please use the following link to create a new issue:

https://new-issue.vuejs.org/?repo=vuejs/vue-cli

If your issue was not created using the app above, it will be closed immediately.

中文用户请注意:
请使用上面的链接来创建新的 issue。如果不是用上述工具创建的 issue 会被自动关闭。
build with component methods always come out this bug.
using vue-cli 3.0+
build with vue ui

@vue-bot
Copy link

vue-bot commented Aug 1, 2018

Hello, your issue has been closed because it does not conform to our issue requirements. In order to ensure every issue provides the necessary information for us to investigate, we require the use of the Issue Helper when creating new issues. Thank you!


你好,你的 issue 不符合我们所要求的格式,因此已被自动关闭。为了确保每个 issue 都提供必需的相关信息,请务必使用我们的 Issue 向导 来创建新 issue,谢谢!

@vue-bot vue-bot closed this as completed Aug 1, 2018
@bivainis
Copy link

In case someone stumbles on this, the error is received when Vue CLI assumes you're building a single file component, and thus requires you to hyphenate component name:

Bad

npx vue-cli-service build --target wc --name mycomponent './src/components/Button.vue'

Good

npx vue-cli-service build --target wc --name my-component './src/components/Button.vue'

Personally, I was receiving this error when I forgot to wrap my [entry] path in quotes (which was not that apparent when the command was in package.json scripts), when creating a bundle that registers multiple components. Which confused me, because I was sure I don't need to hyphenate the name in this case. But what probably happened was that vue-cli discared entry value as invalid and then just took first .vue file from components dir as entry, thus assuming it was supposed to be a single file component.

Error (notice missing quotes)

npx vue-cli-service build --target wc --name companyname ./src/components/*.vue

Success

npx vue-cli-service build --target wc --name companyname './src/components/*.vue'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants