remix
remix copied to clipboard
Warning: Top-Level "this" will be replaced with undefined. Remix + CF Pages
What version of Remix are you using?
1.7.0
Steps to Reproduce
Bundle Remix app and start wrangler pages dev
Expected Behavior
no warnings.
Actual Behavior
Warnings while compiling "worker". => This file is considered to be an ECMAScript module because of the "export"
Traceable to this block (or blocks like this) in functions/[[path]].js
// app/components/Wrapper/Document/Document.jsx
var import_jsx_dev_runtime = __toESM(require_jsx_dev_runtime()), Document = ({ children }) => /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)("html", {
lang: "en",
children
}, void 0, !1, {
fileName: "app/components/Wrapper/Document/Document.jsx",
lineNumber: 4,
columnNumber: 36
}, this);
Addition, relevant package versions:
"@remix-run/cloudflare": "^1.7.0",
"@remix-run/cloudflare-pages": "^1.7.0",
"@remix-run/react": "^1.7.0",
"remix": "^1.7.0",
"@cloudflare/workers-types": "^3.16.0",
"@remix-run/dev": "^1.7.0",
"@remix-run/eslint-config": "^1.7.0",
"wrangler": "^2.0.16",
I too am experiencing this.
Me too, there is a way to temporary fix this, but we need to override the esbuild config (which is not allowed natively in Remix): https://github.com/vitejs/vite/issues/8644#issuecomment-115930880
I started experiencing these errors when I updated a route component to use arrow function syntax (e.g. export default () => { ... }) instead of function keyword syntax (e.g. export default function () { ... }).
When working on a slower processor, the log spam causes the computer's CPU to max out. I've only found my team can continue working if they're on pretty beefy computers (m1 pro or greater).
This bug makes debugging on slower devices nigh impossible. Likely need to be changing what infra we're deploying to due to this issue.
This error starts with @remix-run/cloudflare v1.6.5.
I can also confirm that removing a React component I was using in an MDX file made this warning go away. If I inline the component I was importing, the warning also goes away.
I tried to reproduce this locally with Remix 1.19.3 and wrangler 3.6.0 but wasn't able to reproduce the error. Can you please try again with the latest code? Happy to reopen (or file a new issue) if you can provide a reproduction.
Thanks! 🙏