vike
Version:
(Replaces Next.js/Nuxt) 🔨 Composable framework to build advanced applications with flexibility and stability.
24 lines (23 loc) • 743 B
JavaScript
export { pluginResolvePlusServer };
import { pluginCommon } from './common.js';
import { escapeRegex } from '../../../../utils/escapeRegex.js';
import '../../assertEnvVite.js';
/**
* If +server.js is defined, make virtual:ud:catch-all resolve to +server.js absolute path
*/
function pluginResolvePlusServer(serverFilePath) {
return {
name: 'vike:pluginUniversalDeploy:server',
resolveId: {
order: 'pre',
filter: {
id: new RegExp(escapeRegex(serverFilePath)),
},
handler() {
// Will resolve the entry from the users project root
return this.resolve(serverFilePath);
},
},
...pluginCommon,
};
}