Skip to content

ConfirmationService: require is not defined #1897

Closed
@ValentinCrochemore

Description

@ValentinCrochemore

I'm submitting a ... (check one with "x")

[x] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already  https://github.com/primefaces/primevue/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=110

Current behavior
Whenever my code contains confirm.require() the app breaks with ReferenceError: require is not defined. When I inspect this error in browser I can indeed see const { defineComponent } = require('vue'); added in the component where I included confirm.require(). This defineComponent seems to not be used and if I comment confirm.require(), the error and the require goes away.

Expected behavior
It should not add const { defineComponent } = require('vue'); when using confirm.require()

Minimal reproduction of the problem with instructions
https://codesandbox.io/s/bug-primevue-nuxt-3-bnq9d?file=/pages/test.vue
The page index.vue is there to illustrate that the app works fine. Note that the codesandbox repro is not ideal and has sometimes bugs not related to this one. If you want to reproduce locally please follow this link and copy/paste plugins/primevue.ts & test.vue from codesandbox.

What is the motivation / use case for changing the behavior?
The use case is displaying a confirm dialog when clicking a button. The behavior that should be change is adding const { defineComponent } = require('vue'); when calling confirm.require(). I looked in the source code and could not find where it would happen

Please tell us about your environment:

  • Linux version: 20.04

  • Vue version: 3.2.22

  • Nuxt version: 3.0.0-27296172.f5307f9

  • Vite version: 2.6.14

  • PrimeVue version: 3.10.0

  • Browser: all

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type: BugIssue contains a bug related to a specific component. Something about the component is not working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions