-
Notifications
You must be signed in to change notification settings - Fork 56
Build with Vite #1396
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build with Vite #1396
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is working really well. I am glad we resolved the config hot reloading issue so easily. I'm certainly impressed!
@@ -18,6 +17,7 @@ import { | |||
ItineraryView | |||
} from '../util/ui' | |||
import { getModesForActiveAgencyFilter, getUiUrlParams } from '../util/state' | |||
import { loadLocaleData } from '../util/i18n-loader' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you remember what the purpose of moving this into its own file was? Just curious
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it is to isolate the parts that use the Vite-specific glob imports. This file is mocked for tests (tests continue to use Babel).
@@ -16,9 +14,5 @@ | |||
</head> | |||
<body> | |||
<div id="main"></div> | |||
<script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the explanation!
// index.html is placed at the root of the repo for Vite to pick up. | ||
customFile('HTML_FILE', './index.html', './lib/index.tpl.html') | ||
customFile('CUSTOM_CSS', './tmp/custom-styles.css', './example/example.css') | ||
customFile('YAML_CONFIG', './tmp/config.yml', './example/example-config.yml') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's so fast!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have tested this in almost every configuration I can think of and things look good! I'd prefer if a third reviewer could test with everything they can think of and then I'd say this is ready for merge
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point @alec-georgoff, I'd recommend Node 22. The GitHub CI files in this PR already reference that version. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(removed)
New potential issue: the transitive overlay images aren't being exported correctly when doing a build! But they work in dev mode |
Description
This PR sets Vite as the new build system.
We place customization files (CSS, JS, GraphQL) in the /tmp folder so that imports can use relative paths within the repo root. index.html is copied to the repo root for Vite to pick up, and gets some pre-processing (inject the main script and remove HTML comments).
Other things that we used to configure explicitly that are now included out-of-the-box:
yarn start
works out of the box, even with no environment variables passed (it will use the example subfolder).Things that were dropped:
require
syntaxThings that don't change:
mastarm deploy
seems to still be working (all content in dist is flat, no subfolders)PR Checklist: