Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How should I build two svelte pages with rollup?

Tags:

svelte

I'm following the official Svelte for new developers blog post for my svelte app. It's working fine, and now I want to add a separate "admin" app. Except for interfacing the same database and being hosted on the same domain, it shares no components with my main app.

Would the best approach be to create a second svelte app and host it in a folder, or is there a way do to this in the same rollup?

npx degit sveltejs/template my-project-admin-page
like image 381
Anna Avatar asked Dec 01 '25 20:12

Anna


1 Answers

Your rollup.config.js can return a an array instead, so you would get something like

export default [
  { ...config for normal app ...},
  { ...config for admin app ...}
]

I like to abstract some of the more common parts as well, in a project I am currently working on I have:

export default [
    getConfig('index'),
    getConfig('admin')
]

You could add extra parameters, the one here just points to the main entry point and uses the same name for the bundle

like image 109
Stephane Vanraes Avatar answered Dec 06 '25 07:12

Stephane Vanraes