Require not defined

When using wrangler to deploy a node.js worker I use this command to deploy
wrangler deploy myfoldername/src/worker.js --no-bundle
and I keep getting this error which I cant fix
✘ [ERROR] A request to the Cloudflare API (/accounts//workers/scripts/myfoldername) failed.

Uncaught ReferenceError: require is not defined
at worker.js:1:1

[code: 10021]

and the first line for worker.js is require(‘dotenv’).config();
(Im using wrangler v3.0.0)