-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
The lib target build produces a demo.html which is flawed #3291
Comments
For people coming here in search for a demonstration of the --target lib flag, I quickly created this: https://github.com/awaigand/vue-cli-target-lib-example. |
The docs (https://cli.vuejs.org/guide/build-targets.html#library) for lib target build don't say anything about it including |
In my case the production of this file actually causes a false error. I get an error saying 'TypeError: Converting circular structure to JSON' in the html and at the command line when in fact the library was correctly built |
the demo file should be at least customizable or optionally excluded from the build output |
Anything new on this? I'm currently digging in building vue libraries and am asking myself what to do with this always incomplete/full of error demo.html. How can i profit from it the right way, how to use it? What is its task? complete confused! |
I have to implement a laughable but "working" solution in my vue library: // in package.json
"scripts": {
"build:lib": "vue-cli-service build --target lib --name my-lib src/main.js && rm ./dist/demo.html"
}, Including a no-op demo page in the distribution bundle is hardly a justifiable bonus, it's rather an annoying surprise: this behavior is not documented anywhere and it doesn't accept options to be turned off. |
The culprit seems to be here (I'm trying to produce a web component): vue-cli/packages/@vue/cli-service/lib/commands/build/resolveWcConfig.js Lines 124 to 126 in bd7ad93
I don't know why it configures itself to call it twice 🤷♂️ |
not the demo file, though: vuejs/vue-cli#3291
I've found a workaround how to to remove demo.html.
I've done that for "--target lib", not sure about the other kind of targets. |
Exactly, bump for this! 👊 |
居然到现在还没解决这个问题吗 |
wow...the bug still exists... |
Any update on this issue? |
Bump. Would like to be able to omit the demo.html file when compiling web components. |
Bump. |
1 similar comment
Bump. |
Bump |
Kind of odd that this has received no attention whatsoever from any contributors in the years that this issue has been active. Some control on what happens with the demo.html would be greatly appreciated. https://github.com/karol-f/vue-custom-element being the use case because upstream's For now I'll just run my own script to overwrite the demo.html with my own solution for now at the last step. |
I just created a PR to add information about the demo.html file to the docs so at least future developers are aware of it |
Would be nice to be able to customize the demo.html file (e.g. using public/demo.html as a template). |
I don't quite see this as a bug, as the demo file is here to show you how to include your library. See my related answer on stackoverflow. |
Version
3.3.0
Reproduction link
https://github.com/lee-chase/test-lib
Environment info
Steps to reproduce
2.1. Change build to target lib with a hyphenated library name e.g.
"build": "vue-cli-service build --target lib --name test-lib ./src/main.js",
2.2. Add a suitable index file as an entry point to the component library.
What is expected?
dist/demo.html should be a valid sample web page. Ideally, this would be controllable by the developer to allow them to construct a valid template. Perhaps through use of public/index.html or a Vue template.
It may also be worth including current-script-polyfill as per the documentation for IE support.
What is actually happening?
An invalid demo.html file is produced that is not capable of demonstrating a component.
The text was updated successfully, but these errors were encountered: