-
Notifications
You must be signed in to change notification settings - Fork 35
Add support for assets not mentioned in files
of package.json
#77
Comments
Update: It looks like https://github.com/netlify/zip-it-and-ship-it/pull/48/files#diff-6ff379484cbabad48301d485db111c08R48 should solve this. Now I just need to know how to try the beta 🙂 |
Hi @timsuchanek, thanks for reaching out! For reference purpose, I believe you are speaking about the following Please note also that the problem you are mentioning are As you correctly pointed out, the beta should include a fix for your particular issue. I am going to make sure you're included in our beta so you can make sure Photon.js and Netlify Functions work well together 👍 I will bump this issue once you have access :) |
100% Correct!
Yes, the files that are already shipped with the The files, which are generated on top in |
Yes I can confirm should be packaged with the Netlify Build Beta. I will let you know once you're in! :) |
I just tried it out with the build beta - it works! |
Amazing Tim! Feel free to send us more feedback about the Beta on |
While
zip-it-and-ship-it
right now supports resolvingrequire
statements, if I have apath.join(__dirname, 'somefile')
statement, it gets ignored byzip-it-and-ship-it
, therefore if a package ships some assets, which are not mentioned infiles
of the package.json, they're not included by the packing algorithm.With Photon.js, we're downloading binary files in the
postinstall
hook of the package. These files right now are ignored byzip-it-and-ship-it
, making Photon.js broken in Netlify functions.Note: The binaries are not mentioned in the
files
field of our package.json, as we don't want to ship the binaries when publishing. Instead, they're downloaded in thepostinstall
hook of the@prisma/photon
package.I see a couple of options here:
Give package authors an explicit way to add files in addition to
files
.This option would, however, require a custom standard, library authors shouldn't really have to bother about concrete deployment targets like Netlify.
Just copy over the whole packages, not just what's mentioned in the
files
part.Use smart logic like node-file-trace does (it's used in Zeit Now).
Photon.js is compatible with
node-file-trace
, by addingpath.join(path to binary)
statements in the code, which are recognized bynode-file-trace
.The first step for this smart logic could basically be, including not only the
require
statements of a file, but also thepath.join
/path.resolve
statements.A quick fix could, of course, be having a union of what you have today and the files that
node-file-trace
suggests.I know that you're having a beta implementation, which may have tackled this already, but I don't have access to the build beta yet. I just filled the beta form, in case that's needed.
Thanks!
The text was updated successfully, but these errors were encountered: