UNPKG

telefunc

Version:

Remote functions. Instead of API.

26 lines (25 loc) 849 B
export { previewConfig }; import { apply, addTelefuncMiddleware } from '../helpers.js'; import { determineOutDir } from '../getOutDirs.js'; function previewConfig() { let config; return { name: 'telefunc:previewConfig', apply: apply('preview'), configResolved(config_) { config = config_; const outDir = determineOutDir(config); if (outDir) config.build.outDir = outDir; }, // Ensure that SvelteKit's configurePreviewServer() has precedence, see https://github.com/brillout/telefunc/pull/54 enforce: 'post', configurePreviewServer(server) { return () => { ; process.env.NODE_ENV = 'production'; addTelefuncMiddleware(server.middlewares); }; }, }; }