You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We pulled this code out of the nodejs worker which is essentially a server side app, but haven't updated the bundle/package process to reflect the fact that this is now an npm package. Here are the main changes I think are necessary
Very obvious - don't ship dependencies
This repo should not ship its dependencies in its own package. Each npm package should only ship its own code and npm will handle installing any dependencies in the user's "node_modules" folder. Currently the dependencies are being bundled into the "index-bundle.js" file and we should remove that.
Somewhat obvious - ship files that help with debuggability
Right now if the user tried to "step into" the @azure/functions package they will be taken to a minified mess of a file with no chance of debugging it at all. Instead, I think npm packages should ship their original *.ts files and source map files so that users can debug through the package much more easily.
The main downside is that this increases the size of the package, but honestly it's a pretty minimal difference and the user should get rid of these files in their own bundling process before deploying their app to prod.
More debatable - should the code be bundled/minified
As stated above, we shouldn't use webpack to bundle our dependencies. However, should we use webpack to bundle our own source files into one file? And should it be minified (or "uglified") to make it the most performant as possible? There's no clear answer online, but a few places where people discuss this (example one, example two). The main argument for this is that sadly many user's don't use a bundling process before deploying to prod (even though they should), so we should bundle to improve performance as much as possible. I took a look at some other packages (including azure sdks like @azure/storage-blob) and many appear to ship both a bundled file (storage-blob.js) and a bundled/minified file (storage-blob.min.js). The user can choose which one to use hypothetically, but they use the bundled (and not minified) one by default. I think this makes sense because the bundling process probably makes a way bigger difference on performance than minification, and minification drastically reduces readability.
The text was updated successfully, but these errors were encountered:
We pulled this code out of the nodejs worker which is essentially a server side app, but haven't updated the bundle/package process to reflect the fact that this is now an npm package. Here are the main changes I think are necessary
Very obvious - don't ship dependencies
This repo should not ship its dependencies in its own package. Each npm package should only ship its own code and npm will handle installing any dependencies in the user's "node_modules" folder. Currently the dependencies are being bundled into the "index-bundle.js" file and we should remove that.
Somewhat obvious - ship files that help with debuggability
Right now if the user tried to "step into" the
@azure/functions
package they will be taken to a minified mess of a file with no chance of debugging it at all. Instead, I think npm packages should ship their original*.ts
files and source map files so that users can debug through the package much more easily.The main downside is that this increases the size of the package, but honestly it's a pretty minimal difference and the user should get rid of these files in their own bundling process before deploying their app to prod.
More debatable - should the code be bundled/minified
As stated above, we shouldn't use webpack to bundle our dependencies. However, should we use webpack to bundle our own source files into one file? And should it be minified (or "uglified") to make it the most performant as possible? There's no clear answer online, but a few places where people discuss this (example one, example two). The main argument for this is that sadly many user's don't use a bundling process before deploying to prod (even though they should), so we should bundle to improve performance as much as possible. I took a look at some other packages (including azure sdks like
@azure/storage-blob
) and many appear to ship both a bundled file (storage-blob.js
) and a bundled/minified file (storage-blob.min.js). The user can choose which one to use hypothetically, but they use the bundled (and not minified) one by default. I think this makes sense because the bundling process probably makes a way bigger difference on performance than minification, and minification drastically reduces readability.The text was updated successfully, but these errors were encountered: