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

nuxt3 import #208

Open
Ischafak opened this issue Jan 5, 2024 · 1 comment
Open

nuxt3 import #208

Ischafak opened this issue Jan 5, 2024 · 1 comment

Comments

@Ischafak
Copy link

Ischafak commented Jan 5, 2024

[nuxt] [request error] [unhandled] [500] Named export 'mask' not found. The requested module '/node_modules/vue-the-mask/dist/vue-the-mask.js' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from 'node_modules/vue-the-mask/dist/vue-the-mask.js';
const { mask } = pkg;

when i try to build i get this error

import vmask from 'vue-the-mask';

export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.vueApp.directive(
"mask", vmask.mask
)
})

this is my mask.js plugin file

@viniciusNoleto
Copy link

Hello! I use Nuxt 3 and this worked for me:

import VueTheMask from 'vue-the-mask';

export default defineNuxtPlugin((nuxtApp) => {
  nuxtApp.vueApp.use(VueTheMask);
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants