Does it make sense to minify code used in NodeJS?

Minification can improve performance. Node’s V8 optimizing compiler inlines functions according to some heuristics. Minification influences these heuristics. This can cause inlining of previously not inlined functions. Since inlined functions generally perform faster, this can lead to performance improvements. ###Node 9.0+ / V8 6.2+ (Turbofan) – minor performance improvements If the function’s unoptimized bytecode size … Read more

Webpack bundles my files in the wrong order (CommonsChunkPlugin)

Success! webpack.config.js module.exports = { entry: { app: ‘./app.jsx’, vendor: [ “script-loader!uglify-loader!jquery”, “script-loader!uglify-loader!tether”, “script-loader!uglify-loader!bootstrap”, “script-loader!uglify-loader!wowjs”, ] }, output: { path: __dirname + ‘/dist’, filename: ‘bundle.js’, }, plugins: [ new webpack.optimize.CommonsChunkPlugin({ name: ‘vendor’, filename: “https://stackoverflow.com/questions/42988320/vendor.bundle.js” }), new webpack.optimize.UglifyJsPlugin(), ], }; What magic is happening here? Webpack creates vendor.bundle.js by minifying & bundling my vendor files which … Read more

Angular.module minification bug

I ran into this problem before with Grunt.js Uglify plugin. One of the options are mangle uglify: { options: { mangle: false }, Which I believe runs regex functions on “like strings” and minifys them. For example: angular.module(“imgur”, [“imgur.global”,”imgur.album”]); Would become: angular.module(“a”, [“a.global”,”a.album”]); Disable it — this feature doesn’t play nice with Angular. Edit: To … Read more

Excluding files/directories from Gulp task

Quick answer On src, you can always specify files to ignore using “!”. Example (you want to exclude all *.min.js files on your js folder and subfolder: gulp.src([‘js/**/*.js’, ‘!js/**/*.min.js’]) You can do it as well for individual files. Expanded answer: Extracted from gulp documentation: gulp.src(globs[, options]) Emits files matching provided glob or an array of … Read more