Vite Compile-Away
App code can import platform APIs from WebRuntime during development:
import {
Request,
Response,
fetch,
localStorage
} from '@async/web/runtime/platform';
Use the Vite plugin:
import { webRuntime } from '@async/web/runtime/vite';
export default {
plugins: [
webRuntime()
]
};
Default behavior:
vite devresolves platform imports to scoped WebRuntime APIs.vite buildresolves platform imports to nativeglobalThisAPIs.
Use webRuntime({ target: 'web-runtime' }) for static demos that should keep the route graph after build, or webRuntime({ target: 'native' }) to use native APIs in both dev and build.