bundle-tools icon indicating copy to clipboard operation
bundle-tools copied to clipboard

Bug: 10.0.1 build error after upgrade (+ unplugin-vue-i18n 5.0.0)

Open volarname opened this issue 1 year ago • 7 comments

Reporting a bug?

failed to load config from /home/user/projects/anzusystems/common-admin/vite.config.lib.ts
error during build:
file:///home/user/projects/anzusystems/common-admin/node_modules/@intlify/unplugin-vue-i18n/lib/vite.mjs:1
import { createVitePlugin } from 'unplugin';
         ^^^^^^^^^^^^^^^^
SyntaxError: The requested module 'unplugin' does not provide an export named 'createVitePlugin'
    at ModuleJob._instantiate (node:internal/modules/esm/module_job:131:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:213:5)
    at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
    at async loadConfigFromBundledFile (file:///home/user/projects/anzusystems/common-admin/node_modules/vite/dist/node/chunks/dep-DyBnyoVI.js:66633:15)
    at async loadConfigFromFile (file:///home/user/projects/anzusystems/common-admin/node_modules/vite/dist/node/chunks/dep-DyBnyoVI.js:66474:24)
    at async resolveConfig (file:///home/user/projects/anzusystems/common-admin/node_modules/vite/dist/node/chunks/dep-DyBnyoVI.js:66082:24)
    at async build (file:///home/user/projects/anzusystems/common-admin/node_modules/vite/dist/node/chunks/dep-DyBnyoVI.js:65179:18)
    at async CAC.<anonymous> (file:///home/user/projects/anzusystems/common-admin/node_modules/vite/dist/node/cli.js:828:5)

Expected behavior

project should build without error

Reproduction

https://github.com/anzusystems/common-admin/tree/i18n-bug

clone i18n-bug branch run yarn build

System Info

System:
    OS: Linux 5.15 Ubuntu 22.04.3 LTS 22.04.3 LTS (Jammy Jellyfish)
    CPU: (4) x64 13th Gen Intel(R) Core(TM) i9-13900HX
    Memory: 3.29 GB / 15.62 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 20.9.0 - ~/.nvm/versions/node/v20.9.0/bin/node
    Yarn: 4.5.0 - ~/.nvm/versions/node/v20.9.0/bin/yarn
    npm: 10.1.0 - ~/.nvm/versions/node/v20.9.0/bin/npm
  npmPackages:
    @intlify/unplugin-vue-i18n: ^5.0.0 => 5.0.0
    @vitejs/plugin-vue: ^5.1.4 => 5.1.4
    @vue/eslint-config-prettier: ^9.0.0 => 9.0.0
    @vue/eslint-config-typescript: ^13.0.0 => 13.0.0
    @vue/tsconfig: ^0.5.1 => 0.5.1
    vite: 5.4.6 => 5.4.6
    vite-plugin-dts: ^4.1.1 => 4.1.1
    vite-plugin-vuetify: ^2.0.4 => 2.0.4
    vitepress: 1.3.4 => 1.3.4
    vue: 3.5.6 => 3.5.6
    vue-i18n: 10.0.1 => 10.0.1
    vue-router: 4.4.5 => 4.4.5
    vue-tsc: 2.1.6 => 2.1.6
    vuetify: 3.7.2 => 3.7.2

Screenshot

No response

Additional context

No response

Validations

volarname avatar Sep 19 '24 07:09 volarname

Thank you for your reporting! This issue is not vue-i18n, unplugin-vue-i18n so I'll move this issue

kazupon avatar Sep 21 '24 14:09 kazupon

I'm also affected by this issue and looked into it. The dependency on unplugin is set to ^1.1.0 but the createVitePlugin (and other createXPlugin) functions were added in version 1.3.2 (https://github.com/unjs/unplugin/blob/main/CHANGELOG.md#132-2023-07-03). Manually adding a newer version of unplugin to my project fixes the issue. So I guess the fix here would be to bump the requires version in unplugin-vue-i18n?

nielsvanvelzen avatar Oct 02 '24 08:10 nielsvanvelzen

@nielsvanvelzen how are you manually adding a newer version of unplugin?

Soviut avatar Oct 04 '24 03:10 Soviut

Just install it as an additional dependency in your project: npm i -D unplugin@latest.

nielsvanvelzen avatar Oct 04 '24 07:10 nielsvanvelzen

@nielsvanvelzen thx, i can confirm adding newer version of unplugin solved the issue, bump up the version in unplugin-vue-i18n package should fix this issue

volarname avatar Oct 07 '24 10:10 volarname

This was introduced in d0064c84a570e3133302803e015ae2552ca2a82a, specifically this line of the diff, released in 5.0.0-beta.5. 5.0.0-beta.4 does not exhibit this issue.

AdamVig avatar Oct 16 '24 15:10 AdamVig

Just install it as an additional dependency in your project: npm i -D unplugin@latest.

Thanks, that did help with type errors in the console on startup.

I was still getting a strange type error where $t wasn't recognized in VSCode but the solution to that was to

  • delete package-lock.json
  • rm -rf node_modules
  • npm install
  • npm install vue-tsc@latest

Soviut avatar Oct 16 '24 19:10 Soviut

solved the issue, bump up the version in unplugin-vue-i18n package should fix this issue

Is there any update on when the updated dependency will be released?

janWITZANY avatar Dec 12 '24 22:12 janWITZANY

still not fixed???

volarname avatar Jan 24 '25 15:01 volarname

With the workaround discovered by @nielsvanvelzen, you can also specify an override in your package.json:

  "overrides": {
    "@intlify/unplugin-vue-i18n": {
      "unplugin": "^1.3.2"
    }
  },

stephenhebert avatar Jan 30 '25 22:01 stephenhebert

I believe that this issue is fixed. because the version of unplugin is ^2.2.0. https://github.com/intlify/bundle-tools/blob/0e2959a6ae4228747e109f8057802755d88a4f29/packages/unplugin-vue-i18n/package.json#L36

I'll close this issue. Thanks!

kazupon avatar Mar 20 '25 12:03 kazupon