intlify / bundle-tools

bundling for intlify i18n tools
MIT License
244 stars 37 forks source link

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

Open volarname opened 2 months ago

volarname commented 2 months ago

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

kazupon commented 2 months ago

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

nielsvanvelzen commented 1 month ago

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?

Soviut commented 1 month ago

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

nielsvanvelzen commented 1 month ago

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

volarname commented 1 month ago

@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

AdamVig commented 1 month ago

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.

Soviut commented 1 month ago

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