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

@rollup/plugin-auto-install + vue failing at build time #1500

Closed
patak-dev opened this issue Jan 12, 2021 · 1 comment
Closed

@rollup/plugin-auto-install + vue failing at build time #1500

patak-dev opened this issue Jan 12, 2021 · 1 comment

Comments

@patak-dev
Copy link
Member

patak-dev commented Jan 12, 2021

Is your feature request related to a problem? Please describe.

@rollup/plugin-auto-install works correctly during serve, but fails at build time. Starting from Vanilla worked correctly, but it doesn't when using @vitejs/plugin-vue

This is a repro: https://github.com/matias-capeletto/vite-rollup-plugin-auto-install
nanoid is not listed as a dependency, it should be added automatically.

Here is the error, looks like it is trying to install vue related dependencies instead of only nanoid (as it does during serve)

$ vite build
building for production...
installing vite...
installing @vue/runtime-dom...
installing @vue/shared...
installing nanoid...
[auto-install] Command failed: yarn add vite
error An unexpected error occurred: "ENOENT: no such file or directory, lstat 'C:\\vite-rollup-plugin-auto-install\\node_modules\\esbuild'".

error during build:
Error: Command failed: yarn add vite
error An unexpected error occurred: "ENOENT: no such file or directory, lstat 'C:\\vite-rollup-plugin-auto-install\\node_modules\\esbuild'".

    at ChildProcess.exithandler (node:child_process:333:12)
    at ChildProcess.emit (node:events:376:20)
    at maybeClose (node:internal/child_process:1063:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:295:5)
error Command failed with exit code 1.

Describe alternatives you've considered

I do not know if this is an issue with the plugin or with vite. The plugin could also only be applied only during serve:

export default {
  plugins: [
    { ...autoInstall(), enforce: 'pre', apply: 'serve' },
    vue()
  ]
}

Additional context

vite version: 2.0.0-beta.23
Operating System: Windows 10 Home, 10.0.18363 N/A Build 18363
Node version: v15.5.0
Package manager and version: yarn v1.22.10

@bluwy
Copy link
Member

bluwy commented Jun 26, 2022

Tested this with Vite 3 and latest of plugin-vue and @rollup/plugin-auto-install, and I got the error of [vite:build-import-analysis] Command failed: pnpm install plugin-vue:export-helper in both dev and build. Looks like it isn't happy with the : and thinks it's an npm package that can be installed. I don't think this is an issue in Vite though as any plugins could resolve to something like this, the rollup plugin should validate the npm package before installing. Once fixing the check locally the dev and build runs fine. I'll close this as an upstream issue.

@bluwy bluwy closed this as completed Jun 26, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Jul 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants