I'm playing with pages advanced mode (so _worker.j...
# functions
p
I'm playing with pages advanced mode (so _worker.js file basically) and javascript modules. However it doesn't seem to be working after I try to import module. Am i doing something wrong?
Copy code
// _worker.js
import { add } from "./add";

export default {
  async fetch(request, environment, context) {
    if (request.url.includes("/api/")) {
      console.log("worker", request.url);

      const count = add(2, 3);

      return new Response(count);
    }
    console.log("static", request.url);

    return env.ASSETS.fetch(request);
  },
};


// add.js
export function add(a, b) {
  return a + b;
}