Add main minified dist file as exportable asset#682
Add main minified dist file as exportable asset#682darrachequesne merged 2 commits intosocketio:masterfrom
Conversation
|
Thanks for the pull request! While we're at it, how about expanding it to all .js/.map files in the dist directory? Out of curiosity, could you please explain your use case? |
|
Hi @darrachequesne! Thanks, as for the background I maintain a fairly large codebase at #pylonide/pylon - a web based IDE that depends on engine.io. The way that client side static assets are made available is via a separate static middleware to where assets are fed by resolving the module path name via This method has worked very well so far unless packages introduce exports block that restricts exporting to certain files only. I've now committed modification to include all the |
|
@exsilium thanks for the explanation 👍 |
Note: the
engine.io.jsfile is the generated output ofmake engine.io.js, and should not be manually modified.The kind of change this PR does introduce
Current behaviour
With the recent introduction of the exports block to package.json, modern node limits the files which can be imported from the module. Previously it was possible to import the main dist file directly. Now with the introduction of the exports block one receives an error trying to import the
engine.io.min.jsfile:[ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './dist/engine.io.min.js' is not defined by "exports"Proposal to add at least the minified file to be exportable.
New behaviour
Does not introduce new behaviour, restores old one where it was possible to import any file from the package as there was no exports block on the package level defined - thus node allowed to export any file.
Other information (e.g. related issues)
The complete file list could be expanded to all the .js files listed in
./distin case any other file is consumed directly.