-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Update netlify adapter to integrate includeFiles and excludeFiles options #13194
Conversation
🦋 Changeset detectedLatest commit: 194a27b The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
7d6936e
to
a1bcac7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! I left some questions, and also we should make the docs a bit more explicit because there's some important information that we should expose to users.
if (_config.vite.assetsInclude) { | ||
const mergeGlobbedIncludes = (globPattern: unknown) => { | ||
if (typeof globPattern === 'string') { | ||
const entries = glob.sync(globPattern).map((p) => pathToFileURL(p)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two questions:
- Why aren't these assets resolved from the same
cwd
of line 263? - Why don't we ignore
exclude
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Why aren't these assets resolved from the same
cwd
of line 263?
That is a good question; this code were taken from the vercel integration not sure why that difference does currently exists...
Maybe it does have sense to update this and use the getFilesByGlob
function to have the same behavior on either includeFiles
and vite.assetsInclude
.
- Why don't we ignore
exclude
?
Similar to previous response; this code were taken from the vercel integration but I think there isn't any specific reason to don't exclude
the files therefore we can add it.
I just wanted to keep the most consistency between integration, for those reasons I decided to keep this code as is. Let me know if any modifications are needed, and I'll gladly update it 👌
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the code is been there for a long time, let's keep it as is. Thank you for taking time for investigating and providing me with a proper response!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While the Vercel code has been there for a long time, this is new code for Netlify, so I think it would make sense to make it consistent with the cwd at least
includeFiles?: string[]; | ||
|
||
/** Exclude any files from the bundling process that would otherwise be included. */ | ||
excludeFiles?: string[]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's an important piece of information that is missing from the inline JS docs. The code resolves the files from the rootDir
. This information must be shared with the docs. This information is also missing from the docs PR (I checked).
What does that mean? If a user adds an absolute path, this might fail. We should provide this information.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added a note on the JS Docs 93c2acf#diff-c395613459736f27ff2bafd942481c8713261bd79538e1234994f9d3d4d0be5bR148
Also I will make sure to update the docs to add this important information 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add it to the excludeFiles
block too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
if (_config.vite.assetsInclude) { | ||
const mergeGlobbedIncludes = (globPattern: unknown) => { | ||
if (typeof globPattern === 'string') { | ||
const entries = glob.sync(globPattern).map((p) => pathToFileURL(p)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the code is been there for a long time, let's keep it as is. Thank you for taking time for investigating and providing me with a proper response!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just left an idea of a sample changeset, for your consideration!
Co-authored-by: Matt Kane <[email protected]>
Co-authored-by: Sarah Rainsberger <[email protected]>
This PR implements the changes previously proposed in withastro/adapters#515, migrated to work within this repository's structure. The core functionality remains the same, with adjustments made to align with this repository.
Changes
When trying Netlify SSR with Astro, I wasn't able to get the
included_files
option to work. After investigating, I realized that theincludeFiles
andexcludeFiles
functionalities, similar to what Vercel provides, were necessary to include additional files during the build process.In this PR, I have implemented the integration to add these options:
includeFiles
andexcludeFiles
options to the integration, mirroring Vercel's functionality.includeFiles
: Allows users to explicitly specify files or directories to be bundled with their function. Useful for avoiding missing files in production.excludeFiles
: Enables users to specify files or directories to be excluded from the deployment. Helps minimize bundle size.Testing
includeFiles
andexcludeFiles
with various configurations to ensure:includeFiles
are bundled correctly.excludeFiles
are omitted as expected.Docs
includeFiles
andexcludeFiles
on netlify adapter.