Migrating to modules problems
# workers-help
s
I'm trying to migrate to modules, however it's still using my old event listener for some reason (even though I removed it). `src/worker.js`: (doesn't work)
Copy code
js
export default {
  fetch(request) {
    return new Response("Hello, World!");
  }
}
I tried including a
wrangler.toml
file too but that also didn't work:
Copy code
toml
name = "srnyx-com"
main = "src/worker.js"
I made a new worker with the same code (except no
wrangler.toml
file) and it sort of works. It only still uses the old listener with my base domain (
srnyx.com
), anything else (
jagsdhsifuhwur.srnyx.com
or
srnyx.com/oghjdsuhgusdfhj
) works correctly
My route is
*srnyx.com/*
and I have no page rules
Also, whenever I save the original worker and reload, it deletes all of my work and goes back to when I used an event listener
Now I'm getting this: > Uncaught Error: No such module "main.js". imported from "worker.js" (Code: 10021) `src/worker.js`: ```js import { mainObject } from "./main.js";````src/main.js`: ```js export const mainObject = { // values }```File structure:

https://go-to.srnyx.xyz/chrome_ZOdIaGfgq3.png