You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
539 B
18 lines
539 B
import { Plugin } from "vite";
|
|
|
|
export default function dynamicApp(app: string): Plugin {
|
|
return {
|
|
name: "dynamicApp", // required, will show up in warnings and errors
|
|
resolveId: (id) => {
|
|
// For some reason these are different?
|
|
const productionBuildId = "./__app__.tsx";
|
|
const devBuildId = "/__app__.tsx";
|
|
|
|
if (id === productionBuildId || id === devBuildId) {
|
|
return `${__dirname}/${app}.tsx`;
|
|
}
|
|
|
|
return null;
|
|
},
|
|
};
|
|
}
|
|
|