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

use obfuscator can not dynamic route imports #13020

Closed
7 tasks done
liwy666 opened this issue Apr 27, 2023 · 3 comments · Fixed by #13023
Closed
7 tasks done

use obfuscator can not dynamic route imports #13020

liwy666 opened this issue Apr 27, 2023 · 3 comments · Fixed by #13023
Labels
contribution welcome p3-minor-bug An edge case that only affects very specific usage (priority)

Comments

@liwy666
Copy link

liwy666 commented Apr 27, 2023

Describe the bug

  • use obfuscator build
    image
  • not use obfuscator build
    image
  • show err
    image

Reproduction

https://stackblitz.com/edit/vitejs-vite-28ctb7?file=package.json

Steps to reproduce

npm install
npm run build

System Info

System:
    OS: Linux 5.10 Debian GNU/Linux 11 (bullseye) 11 (bullseye)
    CPU: (12) x64 Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz
    Memory: 55.21 GB / 62.81 GB
    Container: Yes
    Shell: 5.1.4 - /bin/bash
  Binaries:
    Node: 18.16.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 9.5.1 - /usr/local/bin/npm
  npmPackages:
    @vitejs/plugin-legacy: ^2.0.0 => 2.3.1 
    @vitejs/plugin-vue2: ^1.1.2 => 1.1.2 
    vite: ^3.0.2 => 3.2.6

Used Package Manager

npm

Logs

No response

Validations

@stackblitz
Copy link

stackblitz bot commented Apr 27, 2023

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

@bluwy
Copy link
Member

bluwy commented Apr 27, 2023

Looks like it's because Vite's preload marker expects double quotes, but the obfuscator transforms it to single quotes. The fix would be to handle both single and double quotes:

const preloadMarkerWithQuote = `"${preloadMarker}"` as const

@bluwy bluwy added contribution welcome p3-minor-bug An edge case that only affects very specific usage (priority) and removed pending triage labels Apr 27, 2023
@liwy666
Copy link
Author

liwy666 commented Apr 27, 2023

I went through it in a different way,This is my way:

  • vite.config.js
    image
  • src/router/index.js
    image

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

Successfully merging a pull request may close this issue.

2 participants