Open
Description
Hi @stephancasas. So, my boilerplate with the component based structure is coming on nicely. I have, however, decided to swap out rollup with Vite, for build and bundling. Everything works really well. I just want some advice on one item, when including presto in my build chain.
Vite relies on the index.html
file as its starting point. So, before adding presto to my app, the build would basically do the following:
- Scan
index.html
from thesrc
folder - Change relative paths for assets, etc in this file
- Work through
index.js
in thesrc
folder, which is embed in theindex.html
file, and does all the js imports, bundling, etc, etc - Then copy over the final bundle (including the changed
index.html
) to thelist
folder
All of this works 100%.
Now, when including presto in my project, I will have a situation whereby both presto and vite need to make changes to the index.html
. The only way I can see around this is:
- Create a new "main" html file in
src
(exampleapp.html
) - Then change my
presto.config.js
to look something like this:
export default {
input: 'src/app.html',
output: {
file: 'src/index.html',
formatting: 'none'
}
}
- My build commands will then be:
"build:markup": "presto --config presto.config.js",
"build:bundle": "vite build",
"build": "npm-run-all build:markup build:bundle"
- The theory is that presto will do its magic, and then create the
index.html
that vite will use to build and bundle
Does this make sense? Can you think of an easier/better way to achieve this?
Activity