-
-
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
fix: externals bug in vite ssr, promote noExternal as first priority #6023
Conversation
OK,i will modify it
发自我的iPhone
…------------------ Original ------------------
From: Ben McCann ***@***.***>
Date: Thu,Jan 6,2022 10:31 PM
To: vitejs/vite ***@***.***>
Cc: yuuang ***@***.***>, Author ***@***.***>
Subject: Re: [vitejs/vite] fix: externals bug in vite ssr, promote noExternalas first priority (PR #6023)
@benmccann commented on this pull request.
In packages/vite/src/node/ssr/ssrExternal.ts:
> ): boolean { + const noExternalsArr: RegExp[] = + noExternals !== true + ? (Array.isArray(noExternals) ? noExternals : [noExternals]).map( + (item) => { + if (typeof item === 'string') { + item = new RegExp(item)
I don't think you can just convert strings to regexes like this. The strings are meant to be exact matches. If the user wants to provide a regex they can simply pass that to begin with
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
bcdb7c3
to
f87f0ed
Compare
3166f35
to
a06cb4d
Compare
At a high level, I'm not sure why there's two copies of the logic to use |
|
Description
Now, vite ssr external judge condition is not exact.
For example, vite will set default dependencies to ssr.externals, but easy to evaluated failed when someone use ui library like
antd/vant
ssr.externals will be ['vant'].
But in general, these code will be written like
and
style/index.js
import css/less type fileThe expected behavior is
vant
will beexternal
butvant/es/lib/button/style/index.js
cannot be externals need transformed, even if i setssr.noExternal
likecan't take effect because the judge condition is not exact.
Additional context
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).