question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Vite 3.0.8 compatibility

See original GitHub issue

Hi

After upgrading to Vite 3.0.8 i encountered a problem.

Rollup/vite config:


import { defineConfig, loadEnv, PluginOption } from 'vite';
import react from '@vitejs/plugin-react';
import { visualizer } from 'rollup-plugin-visualizer';

// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
  const env = loadEnv(mode, process.cwd(), '');

  return {
    resolve: {
      preserveSymlinks: true,
      alias: {
        '@': fileURLToPath(new URL('./src', import.meta.url)),
      },
    },
    define: {
      APP_VERSION: JSON.stringify(env.npm_package_version),
    },
    build: {
      emptyOutDir: true,
      sourcemap: mode !== 'production',
    },
   // ...
    plugins: [
      react(),
      // ...
      visualizer({
        brotliSize: true,
        gzipSize: true,
        template: 'treemap',
        filename: 'stats/rollup-stats.html',
        title: 'D-Main - Rollup (Build) stats',
      }),
    ],
  };
});

Versions and OS:

  • macbook pro m1 macos 12.5
  • vite: 3.0.8
  • rollup-plugin-visualizer: 5.7.1

Error:

  • Type ‘(PluginOption[] | Plugin)[]’ is not assignable to type ‘PluginOption[]’.

If I remove “visualizer(…)” or cast it as “PluginOption” than the error goes away. This error occurred only after upgrading from 3.0.1 to 3.0.8

Is this rollup plugin not compatible anymore with the newest version?

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
btdcommented, Aug 20, 2022

@zmrl010 seems right, i will wait until vite 3.1. As workaround just cast to PluginOptions or pin rollup to 2.77.3

0reactions
btdcommented, Sep 3, 2022

I added rollup to be optional peer dependency and it seems fixed the issue (need to drop node modules and lock file)

npm ls rollup
test-rollup@0.0.0 /home/den/rollup-vite-repro
├─┬ rollup-plugin-visualizer@5.8.1
│ └── rollup@2.77.3
└─┬ vite@3.0.9
  └── rollup@2.77.3 deduped
Read more comments on GitHub >

github_iconTop Results From Across the Web

Vite 3.0 is out!
Compatibility Notes​​ js 14.18+ / 16+ is now required. Vite is now published as ESM, with a CJS proxy to the ESM entry...
Read more >
Vite 3.0 - New Features & Updates You Must Know - Radixweb
Compatibility Notes · Now NodeJS 14.18+ / 16+ is required as Vite no longer supports NodeJS 12/13/15, which reached its EOL. · With...
Read more >
vite - npm
Native-ESM powered web dev build tool. Latest version: 4.0.3, last published: 2 days ago. Start using vite in your project by running `npm...
Read more >
Vite Rollup Plugins
A list of rollup plugins compatibility for Vite ~3.0.0 ; alias. Define and resolve aliases for bundle dependencies ; auto-install · Automatically install ......
Read more >
Installation | Vue CLI
⚠️ Vue CLI is in Maintenance Mode! For new projects, it is now recommended to use create-vue to scaffold Vite-based projects. Also refer...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found