-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
page use vant and @vitejs/plugin-legacy plugin build. #4358
Comments
@nulladdict I guess this is plugin @vitejs/plugin-legacy bug. |
same error !!! |
I find the way to build success, |
how to fix it? |
index 44d1bbc..d626fdc 100644
--- a/node_modules/@vitejs/plugin-legacy/index.js
+++ b/node_modules/@vitejs/plugin-legacy/index.js
@@ -40,6 +40,7 @@ function viteLegacyPlugin(options = {}) {
const facadeToModernPolyfillMap = new Map()
const modernPolyfills = new Set()
const legacyPolyfills = new Set()
+ let nullFacadeMap = {}
if (Array.isArray(options.modernPolyfills)) {
options.modernPolyfills.forEach((i) => {
@@ -93,12 +94,18 @@ function viteLegacyPlugin(options = {}) {
if (config.build.minify === 'esbuild') {
throw new Error(
`Can't use esbuild as the minifier when targeting legacy browsers ` +
- `because esbuild minification is not legacy safe.`
+ `because esbuild minification is not legacy safe.`
)
}
},
async generateBundle(opts, bundle) {
+ for (const name in bundle) {
+ let chunk = bundle[name]
+ if (chunk.type === 'chunk' && !chunk.facadeModuleId) {
+ nullFacadeMap[chunk.fileName] = chunk
+ }
+ }
if (!isLegacyBundle(bundle, opts)) {
if (!modernPolyfills.size) {
return
@@ -399,6 +406,7 @@ function viteLegacyPlugin(options = {}) {
},
generateBundle(opts, bundle) {
+ Object.assign(bundle, nullFacadeMap)
if (isLegacyBundle(bundle, opts)) {
// avoid emitting duplicate assets
for (const name in bundle) {
@@ -434,7 +442,7 @@ function viteLegacyPlugin(options = {}) {
if (envInjectionFailed) {
config.logger.warn(
`[@vitejs/plugin-legacy] import.meta.env.LEGACY was not injected due ` +
- `to incompatible vite version (requires vite@^2.0.0-beta.69).`
+ `to incompatible vite version (requires vite@^2.0.0-beta.69).`
)
}
} |
@hxdyj Is there a reason why you didn't propose a PR? |
I'am not very familiar with rollup, just fix it, but my way are not good. |
fix: some file are not generated while using @vitejs/plugin-legacy (fix vitejs#4358).
same issue with latest vite and legacy-plugin. |
this is work for me, same problem here |
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [@vitejs/plugin-vue](https://github.com/vitejs/vite) | devDependencies | patch | [`1.10.0` -> `1.10.1`](https://renovatebot.com/diffs/npm/@vitejs%2fplugin-vue/1.10.0/1.10.1) | --- ### Release Notes <details> <summary>vitejs/vite</summary> ### [`v1.10.1`](https://github.com/vitejs/vite/blob/master/packages/plugin-vue/CHANGELOG.md#​1101-httpsgithubcomvitejsvitecompareplugin-vue1100plugin-vue1101-2021-11-26) ##### Bug Fixes - **plugin-vue:** fix hmr issue in vuejs/vue-next[#​4358](vitejs/vite#4358) ([709e4b0](vitejs/vite@709e4b0)) </details> --- ### Configuration 📅 **Schedule**: At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box. --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/1091 Co-authored-by: renovate <renovatebot@kolaente.de> Co-committed-by: renovate <renovatebot@kolaente.de>
I had the same problem before,and i tried use VueRouter without dynamic import() then solved it. |
Hi @hxdyj. I tested the repro locally and this seems to be fixed now. I dont see any files missing after upgrading Vite to 2.8.6 and plugin-legacy to 1.7.1. Can you confirm if this is fixed for you? |
already fixed. Thank you!! |
Describe the bug
page use vant lib and @vitejs/plugin-legacy plugin build. run in chrome58 get Error SystemJS https://git.io/JvFET#3.
but page only use my component, it will be normal.
dist/assets
not has file./index-legacy.62d61901.js
Reproduction
https://github.com/hxdyj/vite-bug-legacy
System Info
Used Package Manager
yarn
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: