I recently switched to webpack from require.js, and some node_module had .min files embedded. When I use the file from node_module, I just do require('my-module')it and it loads it right away without any configuration. But this will load a development version or a larger version.
For example, the reaction is loaded require('react/addons'), but this is not an abridged version.
My question is:
- Should I load the modules normally, and then still cut back?
- Should I use their .min files provided and then still mine? (this way I save a lot of disk)
- The best way? It would be nice to automatically disable thumbnail files.
I am currently modifying webpack aliases to load a mini version when creating the application:
myConfig.resolve.alias.phaserUnFixed = "nodeModules/phaser/build/custom/phaser-no-physics.min.js";
myConfig.resolve.alias.react = "nodeModules/react/dist/react-with-addons.min.js";
myConfig.resolve.alias.lodash = "nodeModules/lodash/dist/lodash.compat.min.js";
myConfig.resolve.alias.moment = "nodeModules/moment/min/moment.min.js";
But this is also a bad approach ... Can you come up with something better?
source
share