-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
Fresh Nuxt 2 and Bridge giving errors in components when using v-on events - defineComponent is not defined
#54
Comments
@danielroe I don't think it's related, but I see the same error is mentioned in nuxt/nuxt.js#13077 when discussing vue test utils |
Another strange occurrence: if I change the component template to this (replace the <template>
<div>
<input @change="test" />
<!-- test -->
</div>
</template>
<script>
export default defineComponent({
name: 'BaseButton',
methods: {
test() {
console.log('test')
},
},
})
</script> And even if it's just two comments: <template>
<div>
<!-- test -->
<!-- test -->
</div>
</template>
<script>
export default defineComponent({
name: 'BaseButton',
})
</script> |
@Jamiewarb I am experiencing the same, did you find any other solutions besides importing it with an alias. |
Same here :/ |
Working example here: https://github.com/rodrigogs/juquinha/blob/master/modules/web/pages/dashboard.vue To make it break, just remove the |
Same problem here, without alias is not possible to work around it. Any solutions? |
cc: @antfu |
any news on this issue please? |
Environment
Nuxt CLI v3.0.0-27333388.c824905 16:10:20
RootDir: /Users/jamie/Sites/bignight/define-component 16:10:20
Nuxt project info: 16:10:20
Darwin
v16.13.0
2.16.0-27332655.777a4b7f
[email protected]
Webpack
head
,css
,plugins
,components
,buildModules
,modules
,build
-
@nuxtjs/[email protected]
,@nuxt/[email protected]
Reproduction
Please see this repo for a full reproduction: https://github.com/Jamiewarb/repro-define-component
Describe the bug
When adding a component that handles an event with
v-on
, I'm sometimes getting the errordefineComponent is not defined
.In the reproduction, this occurs when there are two elements in the component that both have a
v-on
. Later investigation shows that this also occurs when either or both of those elements are simple html comments<!-- -->
as well.Additional context
To get the error:
yarn dev
and open localhost:3000 in a browser.To circumvent the error:
<input>
element or the entire<button>
element.The docs say you can also import from
#imports
directly, but this gives another error:import { defineComponent } from '#imports';
inside the<script>
tagModule parse failed: Identifier 'defineComponent' has already been declared (10:9)
error in terminalHowever, importing it under an alias successfully circumvents this problem entirely:
import { defineComponent as dC } from '#imports'
.export default dC({ ... })
.Logs
The text was updated successfully, but these errors were encountered: