vue-simple-password-meter icon indicating copy to clipboard operation
vue-simple-password-meter copied to clipboard

Vite version 2.9.13 issue

Open nekolii7 opened this issue 3 years ago • 4 comments

Hi, I'm using a new create-vue-app application which now instead if vue-cli uses vite. I used the vue-simple-password-meter in the past with vue-cli but after the switch I get the following error, when I use an version of vite which is higher than 2.9.13.

Uncaught SyntaxError: The requested module '/node_modules/vue-simple-password-meter/dist/PasswordMeter.umd.js?v=ad0801a8' does not provide an export named 'default'

I'm using version 1.1.0 of this package.

Vue version: 3.2.37 Vite version: 3.0.4

nekolii7 avatar Aug 05 '22 09:08 nekolii7

Hi @nekolii7,

I tested it on my local machine and it worked can you share a code sandbox or a repository of reproduced bug?

Thanks.

miladd3 avatar Aug 21 '22 16:08 miladd3

Encountered the same issue. For me excluding the library from vite optimizeDeps resolved the issue.

in vite.config.js add:

optimizeDeps: { exclude: ['vue-simple-password-meter/dist/PasswordMeter.umd.js'] }

lucifilote avatar Sep 30 '22 13:09 lucifilote

I updated the library and the problem should be fixed by now can anyone also test this?

just update to v1.1.2

miladd3 avatar Dec 05 '22 21:12 miladd3

Does not seem to work @miladd3 Using latest version v1.3.4. I also tried to implement @lucifilote's fix, but that also doesn't seem to work, also with the updated path.

Full config (of the library):

optimizeDeps: {
    exclude: ['vue-simple-password-meter/dist/vue-simple-password-meter.umd.js']
},
build: {
    rollupOptions: {
      // make sure to externalize deps that shouldn't be bundled into your library
      external: [
        'vue-simple-password-meter'
      ],
      output: {
        // Provide global variables to use in the UMD build for externalized deps
        globals: {
          'vue-simple-password-meter': 'PasswordMeter'
        }
      }
}

I am using the following structure:

I have a library, with the vue-simple-password-meter as a dependency (not dev), and as a peer dependency. I install that library in a vite application, and also add the vue-simple-password-meter in the dependencies.

It does seem to work when I build (but that also worked without the optimizeDeps).

sybrendotinga avatar Jun 27 '23 09:06 sybrendotinga