telefunc
Version:
Remote functions. Instead of API.
23 lines (22 loc) • 773 B
JavaScript
export { pluginPreview };
import { apply } from '../shared/apply.js';
import { addTelefuncMiddleware } from '../shared/addTelefuncMiddleware.js';
function pluginPreview() {
return [
{
name: 'telefunc:pluginPreview',
apply: apply('preview'),
// Ensure that SvelteKit's configurePreviewServer() has precedence, see https://github.com/brillout/telefunc/pull/54
enforce: 'post',
configurePreviewServer: {
handler(server) {
return () => {
;
process.env.NODE_ENV = 'production';
addTelefuncMiddleware(server.middlewares);
};
},
},
},
];
}