This error occurs because your code uses the 'lodash.throttle' library, but Rollup cannot find it. To fix this, add 'lodash.throttle' to the 'build.rollupOptions.external' configuration.

In your 'vite.config.js' file, locate the 'build.rollupOptions' configuration. If it doesn't exist, add it. Then, add an 'external' property and include 'lodash.throttle' in the array, like this:

export default defineConfig({
  // other config options...
  build: {
    rollupOptions: {
      external: ['lodash.throttle']
    }
  }
})

Save the file and restart your application. This should fix the error.

Vite Rollup Error: Cannot Resolve 'lodash.throttle' Import

原文地址: https://www.cveoy.top/t/topic/qpDo 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录