Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🐛 Bug]: iifefy breaks export default string contents #871

Open
1 task
nickbabcock opened this issue Sep 2, 2024 · 0 comments
Open
1 task

[🐛 Bug]: iifefy breaks export default string contents #871

nickbabcock opened this issue Sep 2, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@nickbabcock
Copy link
Contributor

nickbabcock commented Sep 2, 2024

next-on-pages environment related information

System:
        Platform: linux
        Arch: x64
        Version: #40~22.04.3-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 30 17:30:19 UTC 2
        CPU: (12) x64 AMD Ryzen 9 5900X 12-Core Processor
        Memory: 20 GB
        Shell: /bin/bash
Package Manager Used: npm (10.8.1)

Relevant Packages:
        @cloudflare/next-on-pages: 1.13.2
        vercel: N/A
        next: N/A

Description

all instances of "export default " get replaced by "return " even if the "export default " occurs within a string (ie: not javascript that gets executed):

Seems like

Reproduction

Pretty easy to replicate:

import { NextResponse } from "next/server";
export const runtime = "edge"

export const GET = () => NextResponse.json("LOREM export default IPSUM");

What gets uploaded to cloudflare ends up being "LOREM return IPSUM"

Pages Deployment Method

None

Pages Deployment ID

No response

Additional Information

The best workaround I've found is to do string concatenation with values wrapped in promises.

It's tedious but some layer in the pipeline can do constant folding which thwarted more straightforward solutions.

Would you like to help?

  • Would you like to help fixing this bug?
@nickbabcock nickbabcock added the bug Something isn't working label Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant