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

@vitejs/plugin-legacy: __vite_legacy_guard error with systemjs and single-spa #12017

Closed
7 tasks done
adrianorob90 opened this issue Feb 10, 2023 · 6 comments
Closed
7 tasks done

Comments

@adrianorob90
Copy link

adrianorob90 commented Feb 10, 2023

Describe the bug

I made a single-spa-application with Vite and Svelte. The bundle in Systemjs format contains an error due to the presence of the __vite_legacy_guard export, without it everything works correctly. An option to disable __vite_legacy_guard would be useful.
Schermata 2023-02-10 alle 11 40 02

Reproduction

https://github.com/adrianorob90/svelte-skeleton-vite

Steps to reproduce

npm i 
npm run build

After open the file
dist/20/svelte-skeleton/js/svelte-skeleton-main.0.1.0.js

System Info

System:
    OS: macOS 12.2.1
    CPU: (8) arm64 Apple M1 Pro
    Memory: 63.80 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.15.0 - ~/.nvm/versions/node/v16.15.0/bin/node
    Yarn: 1.22.15 - ~/.nvm/versions/node/v16.15.0/bin/yarn
    npm: 8.5.5 - ~/.nvm/versions/node/v16.15.0/bin/npm
  Browsers:
    Chrome: 109.0.5414.119
    Safari: 15.3
  npmPackages:
    @vitejs/plugin-legacy: ^4.0.1 => 4.0.1 
    vite: ^4.1.0 => 4.1.1

Used Package Manager

npm

Logs

No response

Validations

@bluwy
Copy link
Member

bluwy commented Feb 13, 2023

The main non-legacy (or modern) chunk shouldn't be a systemjs file by default unless you change that? If so, it wouldn't work as plugin-legacy expects the modern chunk to be ESM. If not, a repro would help dissect the issue.

@github-actions
Copy link

Hello @adrianorob90. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with need reproduction will be closed if they have no activity within 3 days.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Feb 17, 2023
@adrianorob90
Copy link
Author

hi @bluwy I added a link to the repo to reproduce the error :)

@patak-dev
Copy link
Member

As @bluwy said in his prev message, you shouldn't change to systemjs for the main build here

@adrianorob90
Copy link
Author

Hi @patak-dev I need the systemjs version to load the project in the single-spa root project. Alternatively how can I do it?

@bluwy
Copy link
Member

bluwy commented Feb 27, 2023

You need to use plugin-legacy if you need systemjs. If you need that format only, you can follow #10139 so it's configurable to ship systemjs only.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants