Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

296
Views
How can I add a file to the default bundle generated by Vite?

In the routing configuration of a Vue.js 2.x app, any statically imported components will be added to the default bundle. Any dynamically imported components will be saved in a separate bundle, e.g.

// routes.js
import Component1 from '@/component1.vue' // added to default bundle
import Component2 from '@/component2.vue' // added to default bundle

const Component3 = () => import('@/component3.vue') // saved in a bundle on its own
const Component4 = () => import('@/component4.vue') // saved in a bundle on its own

If I want to add a JavaScript file (not a Vue component) to the default bundle, I could also import in routes.js, but I then get an ESLint warning/error that I've an unused import.

import myService from '@/services/my-service.js' // eslint-disable-line no-unused-vars 

The app in question is built with Vite which uses Rollup to bundle files. Is there a more elegant way to add a .js file to the default bundle, e.g. via the rollupOptions in vite.config.js

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!