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

134
Views
How to keep root level `export` when building with Vite in format `esm`

it's a pretty simple requirement,

I hope the building result can keep the export statement in main.js,

so that I can load the script in a <script type="module"> tag and get the exported variable.

but now, the building result keeps import statement, but the export export default is lost.

any idea ?

// entry point 'main.js'
import { mount } from "./lifecycle";
export {mount};
export default mount();
// vite-config.js
export default defineConfig({
  plugins: [svelte()],
  build:{
    rollupOptions: {
      treeshake: false,
      output: {
        format: 'es'
      }
    }
  },
})
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!