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

Line limit from esbuild breaks vite production build #16529

Open
7 tasks done
Xerios opened this issue Apr 25, 2024 · 1 comment
Open
7 tasks done

Line limit from esbuild breaks vite production build #16529

Xerios opened this issue Apr 25, 2024 · 1 comment
Labels
contribution welcome feat: build p3-minor-bug An edge case that only affects very specific usage (priority)

Comments

@Xerios
Copy link
Contributor

Xerios commented Apr 25, 2024

Describe the bug

Cross-post from esbuild: evanw/esbuild#3735


Using low values for lineLimit such as 160 or 80 seems to break dynamic import from Vite as seen in my results below:

Line limit 160:

prop: ()=>Xn(()=>Promise.resolve().then(()=>BW), "\
__VITE_PRELOAD__"),

Line limit 500:

prop: ()=>Xn(()=>Promise.resolve().then(()=>BW), void 0)

the actual code itself is a function that imports a svelte file:

prop: () => import('./someSvelteFile.svelte'),

I don't fully understand the underlying but due to the "\ it seems like Vite no longer replaces __VITE_PRELOAD__

Reproduction

n/a

Steps to reproduce

Unfortunately I couldn't manage to properly reproduce this issue in a minimal example, but in our large code-base it definitely happens consistently

System Info

System:
    OS: Windows 10 10.0.19045
    CPU: (32) x64 13th Gen Intel(R) Core(TM) i9-13900K
    Memory: 14.89 GB / 31.76 GB
  Binaries:
    Node: 18.20.2 - C:\Program Files\nodejs\node.EXE  
    Yarn: 1.22.19 - C:\Program Files\nodejs\yarn.CMD  
    npm: 9.6.2 - C:\Program Files\nodejs\npm.CMD      
    pnpm: 9.0.6 - C:\Program Files\nodejs\pnpm.CMD    
  Browsers:
    Edge: Chromium (123.0.2420.97)
  npmPackages:
    vite: ^5.2.10 => 5.2.10

Used Package Manager

pnpm

Logs

n/a

Validations

@bluwy
Copy link
Member

bluwy commented Apr 29, 2024

Didn't know that you can break strings this way. Seems like this should be fixable in Vite by relaxing this regex:

const preloadMarkerWithQuote = new RegExp(`['"]${preloadMarker}['"]`, 'g')

Could also write a new unit test for this regex if anyone likes to fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution welcome feat: build p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

No branches or pull requests

2 participants