Closed LukeTOBrien closed 2 years ago
I'm also using Playwright for PDF generation. As a workaround what I did is manually delete the linux/mac folders on my deployment server. Saved a little bit of space. It seems to still work.
My understanding is that Nuget does not allow us to download selective binaries, for the selected platform. So the only solution to this is platform-specific Nuget packages, something we'd want to see upvoted / validated before we do it.
The CopyPlaywrightFilesToOutput
target could be adjusted to only copy the node folder for the current OS or check for a custom <PlaywrightPlatform>
property so the user can set it themselves in their project. E.g.
<PropertyGroup>
<PlaywrightPlatform Condition="'$(PlaywrightPlatform)' == '' AND $([MSBuild]::IsOSPlatform('Linux'))">linux</PlaywrightPlatform>
<PlaywrightPlatform Condition="'$(PlaywrightPlatform)' == '' AND $([MSBuild]::IsOSPlatform('Windows'))">windows</PlaywrightPlatform>
<PlaywrightPlatform Condition="'$(PlaywrightPlatform)' == '' AND $([MSBuild]::IsOSPlatform('OSX'))">macos</PlaywrightPlatform>
<PlaywrightPlatform Condition="'$(PlaywrightPlatform)' == ''">all</PlaywrightPlatform>
</PropertyGroup>
<ItemGroup>
<_CopyItems Include="$(MSBuildThisFileDirectory)..\.playwright\package\**" />
<_CopyItems Include="$(MSBuildThisFileDirectory)..\.playwright\node\LICENSE" />
<_CopyItems Include="$(MSBuildThisFileDirectory)..\.playwright\node\**" Condition="'$(PlaywrightPlatform)' == 'all'" />
<_CopyItems Include="$(MSBuildThisFileDirectory)..\.playwright\node\linux\**" Condition="'$(PlaywrightPlatform)' == 'linux'" />
<_CopyItems Include="$(MSBuildThisFileDirectory)..\.playwright\node\win32_x64\**" Condition="'$(PlaywrightPlatform)' == 'windows'" />
<_CopyItems Include="$(MSBuildThisFileDirectory)..\.playwright\node\mac\**" Condition="'$(PlaywrightPlatform)' == 'macos'" />
</ItemGroup>
Hello,
When you build a project with the Playwright NuGet installed there is a folder called
.playwright
in thebin/Debug
orbin/Release
, inside this folder is two more folders:node
(197MB) andpackage
(11.8MB).node
folder contains:linux
(70.9MB)mac
(72.6MBwin32_64
(54.2MB)Is there a way to specify that I only intend to use
win32_64
platform say? That would mean that the other two are not needed and thus save space.I also noticed that
win32_64
folder containsnode.exe
, is that strictly necessary? As I have node installed and set in the PATH environmental variable.The project I am working perhaps is using Playwright differently from intended, I have a WYSIWYG editor to edit a web site and I want to export the site as a PDF, so I'm using the Page.Pdf method to do that.
The problem is 197MB is a bit large to send to my server via FTP, so I'm wondering how to reduce.
Thanks,
Luke