Modules export minified code
See original GitHub issueThe UMD modules available in npm export minified code. While this does not stop us using these modules, it throws warnings in our Webpack dev server. Since these are source modules would it make more sense to export them un-minified and leave the end user to handle minification?
Example of console warning:
./~/braintree-web/client.js
Critical dependencies:
1:438-445 This seems to be a pre-built javascript file. Though this is possible, it's not recommended. Try to require the original source to get better results.
@ ./~/braintree-web/client.js 1:438-445
Issue Analytics
- State:
- Created 7 years ago
- Reactions:3
- Comments:10 (4 by maintainers)
Top Results From Across the Web
How to minify/obfuscate separate JS modules in a way that ...
So I need the API to be minified in the same way, to use the same names. For example - if export function...
Read more >The JavaScript Modules Handbook – Complete Guide to ES ...
A JavaScript module is a file that allows you to export its code. ... In other words, distribution code is the minified and...
Read more >Package exports - webpack
The exports field in the package.json of a package allows to declare which module should be used when using module requests like import...
Read more >Modules, introduction - The Modern JavaScript Tutorial
A module code is evaluated only the first time when imported · A module exports some means of configuration, e.g. a configuration object....
Read more >Best Practice Tips for Writing Your JS Modules
Just output the code as authored or as close to it as possible and let the client figure out if they want it...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The problem is not that it’s minified, but that it is pre-built using Browserify. If you use the the debug versions of the files which are not minified (like
require('braintree-web/client.debug')
), you’ll get the same error because they are still bundled beforehand.We’re discussing how we can support Webpack without displaying these errors, but it requires us to change how we distribute the files and we want to make sure we don’t break anyone who is already using the package. For example, if someone is downloading the module through npm and then copying the files from the node_modules folder directly to their frontend, providing pre-built files would break their integration as soon as they upgraded to a new minor version.
Thanks for the detailed response, @M-Porter. You are absolutely correct; we overlooked our
index.js
anddebug.js
files which still had references torequire
.We have just released version
3.3.0
where these two files are correctly bundled without references torequire
.