-
-
Notifications
You must be signed in to change notification settings - Fork 2.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
🐛Vue self-closing tags broken on build but fine on dev #1103
Comments
I found this: posthtml/posthtml-parser#23 maybe we need a option passing into parse() |
Self-closing tags are working for me on 1.7, however I'm seeing the same issue. I believe the problem is the two div children in the parent div. For example, if I have:
then axios will be undefined when using "build" but be fine when in dev mode. However,
and
Both work correctly. See if the self closing tag works by itself in your div without the sibling. Mind you, this is still a bug. |
I am not sure if this is the same issue, but I'm getting an "invalid attribute name" when running I can't be sure, though, since the error doesn't tell me which file or compinent it is coming from. |
@andrewbanchich this is a individual issue, same goes for #1089 it would be great if you can open up a issue that contains your markup 😊 |
Any progress? This blocks us from switching to Parcel. It’s reasonable for parcel to use xml mode in parsing vue files, since it is not really valid html at all (though vue claims it can be, for embedding templates in html). Most vue linters requires self-closing when no content presented in the element. |
I've investigate your issue since mine is resolved. This is a simple example to test the issue in a isolated enviroment. var posthtml = require('posthtml');
var htmlnano = require('htmlnano');
var html = '<div><div class="test-self-close" /><div>inside</div></div>'
var options = {closingSingleTag: 'slash'}
posthtml().process(html, options).then(function (result) {
console.log(result.html)
console.log(JSON.stringify(result.tree, null, 2))
}).catch(function (error) { return console.log(error) }) @laosb you can avoid this issue for now by configuration parcel via the API https://parceljs.org/api.html just make sure to run the script with with the correct enviroment variables eg: process.env.NODE_ENV === 'production' const Bundler = require('parcel-bundler');
const Path = require('path');
const file = Path.join(__dirname, './index.html');
const options = {
// prevents posthtml from being called as long as the markup is not dirty
minify: false,
};
const bundler = new Bundler(file, options);
bundler.bundle(); |
What about creating a |
@DeMoorJasper tried all possible configurations, the issue is how posthtml seperates selfclosing tags. For example the option You can test that via the option variable. eg: |
Any updates on this? Ran into this in production today and it kind of sucks. |
@K900 we probably need to await this PR posthtml/posthtml-parser#21, but it is really outdated by now. Maybe we could create a issue to increase the importance. I'll do it later today. |
Not sure why this was closed. This is still happening for me and completely broke my site build. |
@andrewbanchich Can you try config |
@luikore That worked! Thank you!!! How did you find that setting documentation? |
When a
div
is self-closed in vue template, it will not correctly closed causing things below get embed in that self-closing tag.And strangely it's a production-build-only (
parcel build
) bug. Works fine on dev.🎛 Configuration (.babelrc, package.json, cli command)
Included in repro.
💁 Possible Solution
No idea, even don't know it's a Vue issue or a Parcel issue.
🔦 Context
💻 Code Sample
laosb/parcel-vue-test@60baa3f
🌍 Your Environment
The text was updated successfully, but these errors were encountered: