Parcel produces bundles like this one where all required dependencies are included in a single file. The require() function is injected. For example, the following line:
With our current algorithm, the require() statement will not find the dependent file and create a build-time error.
When we detect that a Function file is a Parcel bundle, we should instead skip dependencies crawling. We should make sure this does not break any existing Parcel bundled Functions.
Background at https://community.netlify.com/t/netlify-plugin-functions-core-fails-on-dependencies-that-are-bundled-already/22836
Parcel produces bundles like this one where all required dependencies are included in a single file. The
require()
function is injected. For example, the following line:https://gist.github.com/Industrial/60aed2605953206ab04c9dde62ddc60b#file-markets-js-L162
Uses the
require
function defined here:https://gist.github.com/Industrial/60aed2605953206ab04c9dde62ddc60b#file-markets-js-L1
Which ends up calling the other bundled file:
https://gist.github.com/Industrial/60aed2605953206ab04c9dde62ddc60b#file-markets-js-L48
With our current algorithm, the
require()
statement will not find the dependent file and create a build-time error.When we detect that a Function file is a Parcel bundle, we should instead skip dependencies crawling. We should make sure this does not break any existing Parcel bundled Functions.