diff --git a/examples/server.js b/examples/server.js index 675db3b..0ac9847 100644 --- a/examples/server.js +++ b/examples/server.js @@ -1,4 +1,5 @@ import { unlinkSync } from 'node:fs'; +import { resolve } from 'path'; const transpiler = Bun.Transpiler({ loader: 'cjs', }); @@ -9,9 +10,9 @@ export default { const magicKey = Math.random().toString(36).substring(2, 10); const url = new URL(req.url); if (url.pathname == '/main.js') { - const path = `./.cache/`; + const path = resolve(__dirname, `./.cache/`); const filename = `${magicKey}.js`; - const file = Bun.file(`${path}/${filename}`); + const file = Bun.file(resolve(path, filename)); const result = await Bun.build({ entrypoints: ['./src/main.js'], outdir: path, @@ -27,12 +28,13 @@ export default { }); setTimeout(() => { - unlinkSync(`${path}/${filename}`); + unlinkSync(resolve(path, filename)); }, 400); return resp; } - if (url.pathname == '/') return new Response(Bun.file('./index.html')); + if (url.pathname == '/') + return new Response(Bun.file(resolve('./index.html'))); return new Response('ERR 404: Not Found', { status: 404 }); }, }; diff --git a/examples/src/main.js b/examples/src/main.js index 6383a11..9bd7c79 100644 --- a/examples/src/main.js +++ b/examples/src/main.js @@ -1,5 +1,11 @@ import Cetra from '../../lib/lib.js'; +import Interact from '../../lib/plugins/Interact.js'; +import UtilsPlugin from '../../lib/plugins/Utils.js'; const ctra = new Cetra({ root: 'body', + plugins: new Map([ + ['interact', Interact], + ['utils', UtilsPlugin], + ]), });