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

Incorrect prop expansion when key and value names are equal #845

Closed
xPaw opened this issue Mar 16, 2020 · 0 comments
Closed

Incorrect prop expansion when key and value names are equal #845

xPaw opened this issue Mar 16, 2020 · 0 comments

Comments

@xPaw
Copy link

xPaw commented Mar 16, 2020

Version

3.0.0-alpha.8

Reproduction link

https://github.com/thelounge/thelounge/blob/52002c3e227bbb3ac568d774ed03c08794ee954b/client/components/ChannelWrapper.vue#L8

Steps to reproduce

<template>
	<div :class="[{active: active}, {thisworks: active}]"></div>
</template>

<script>
export default {
	name: "ChannelWrapper",
	props: {
		active: Boolean,
	},
};
</script>

What is expected?

Compiles to {active: _ctx.active}.

What is actually happening?

Compiling via webpack with vue-loader, produces the following code which is not valid JS:

Module parse failed: Unexpected token (5:27)
File was processed with these loaders:
 * ./node_modules/vue-loader/dist/templateLoader.js
 * ./node_modules/vue-loader/dist/index.js
You may need an additional loader to handle the result of these loaders.

| export function render(_ctx, _cache) {
|   return (_openBlock(), _createBlock("div", {
>     class: [{active: active: _ctx.active}, {thisworks: _ctx.active}]
|   }, null, 2 /* CLASS */))
| }

As you can see it produced {active: active: _ctx.active}


Installed packages:

"@vue/compiler-sfc": "3.0.0-alpha.8",
"vue": "3.0.0-alpha.8",
"vue-loader": "16.0.0-alpha.3",
"webpack": "4.42.0",

This works in vue2.

@github-actions github-actions bot locked and limited conversation to collaborators Nov 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant