cloudflare / worker-template

a template to kickstart your Cloudflare worker!
Apache License 2.0
172 stars 99 forks source link

Use webpack instead of javascript #26

Open exvuma opened 5 years ago

exvuma commented 5 years ago

Have this default template use webpack as a type in wrangler.toml

Then move index.js to ./src/index.js and update package.json?

I am not sure if it will confuse users by now having src, workers-site and worker directories that all contain a worker script though. This probably needs design

EverlastingBugstopper commented 5 years ago

workers-site is not in this template

exvuma commented 5 years ago

workers-site is not in this template

Correct nor worker until build time. We would be adding a new directory concept: src. (which yes seems simple enough but then we have worker-site for site projects) I just think it's confusing that we are defining all these different directories. Also, the other templates just use index.js so it'd be another chore to change all the others.

I am open more opinions though if we think this should be a priority

EverlastingBugstopper commented 5 years ago

yeah. this is just how i structure projects, it gets really messy really quick if you want to start adding more files other than index.js which is why i like a src directory. it's a very common pattern that i dont think people would be confused by and seems separate from the concerns about build directories.

kristianfreeman commented 5 years ago

I also add src as soon as a project gets complex, but just switching to webpack doesn't necessarily mean that we need to add src here, right? afaik our webpack type looks for index.js