Closed Igor-Yavych closed 1 year ago
babel-plugin-transform-merge-sibling-variables
is
used by @putout/minify
, what error do you have? How do you use minify
?
Yeah, figured that to be the case.
Using it like minify test.js > test.min.js
, same as with 9.2.0
Here is the trace:
Error: Cannot find module 'babel-plugin-transform-merge-sibling-variables'
Require stack:
- /usr/local/lib/node_modules/minify/node_modules/@babel/core/lib/config/files/plugins.js
- /usr/local/lib/node_modules/minify/node_modules/@babel/core/lib/config/files/index.js
- /usr/local/lib/node_modules/minify/node_modules/@babel/core/lib/index.js
- /usr/local/lib/node_modules/minify/node_modules/@putout/engine-loader/lib/transforms/babel.js
- /usr/local/lib/node_modules/minify/node_modules/@putout/engine-loader/lib/wrap-plugin.js
- /usr/local/lib/node_modules/minify/node_modules/@putout/engine-loader/lib/load.js
- /usr/local/lib/node_modules/minify/node_modules/@putout/engine-loader/lib/index.js
- /usr/local/lib/node_modules/minify/node_modules/putout/lib/putout.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1090:15)
at resolve (node:internal/modules/helpers:125:19)
at tryRequireResolve (/usr/local/lib/node_modules/minify/node_modules/@babel/core/lib/config/files/plugins.js:102:11)
at resolveStandardizedNameForRequire (/usr/local/lib/node_modules/minify/node_modules/@babel/core/lib/config/files/plugins.js:136:19)
at resolveStandardizedName (/usr/local/lib/node_modules/minify/node_modules/@babel/core/lib/config/files/plugins.js:151:12)
at loadPlugin (/usr/local/lib/node_modules/minify/node_modules/@babel/core/lib/config/files/plugins.js:47:20)
at loadPlugin.next (<anonymous>)
at createDescriptor (/usr/local/lib/node_modules/minify/node_modules/@babel/core/lib/config/config-descriptors.js:139:16)
at createDescriptor.next (<anonymous>)
at evaluateSync (/usr/local/lib/node_modules/minify/node_modules/gensync/index.js:251:28)
at /usr/local/lib/node_modules/minify/node_modules/gensync/index.js:31:34
at Array.map (<anonymous>)
at Function.sync (/usr/local/lib/node_modules/minify/node_modules/gensync/index.js:31:22)
at Function.all (/usr/local/lib/node_modules/minify/node_modules/gensync/index.js:210:24)
at Generator.next (<anonymous>)
at createDescriptors (/usr/local/lib/node_modules/minify/node_modules/@babel/core/lib/config/config-descriptors.js:101:41)
at createDescriptors.next (<anonymous>)
at createPluginDescriptors (/usr/local/lib/node_modules/minify/node_modules/@babel/core/lib/config/config-descriptors.js:98:17)
at createPluginDescriptors.next (<anonymous>)
at /usr/local/lib/node_modules/minify/node_modules/@babel/core/lib/config/config-descriptors.js:64:32
at Generator.next (<anonymous>)
at Function.<anonymous> (/usr/local/lib/node_modules/minify/node_modules/@babel/core/lib/gensync-utils/async.js:21:3)
at Generator.next (<anonymous>)
at evaluateSync (/usr/local/lib/node_modules/minify/node_modules/gensync/index.js:251:28)
at Function.sync (/usr/local/lib/node_modules/minify/node_modules/gensync/index.js:89:14)
at sync (/usr/local/lib/node_modules/minify/node_modules/@babel/core/lib/gensync-utils/async.js:62:25)
at sync (/usr/local/lib/node_modules/minify/node_modules/gensync/index.js:182:19)
at onFirstPause (/usr/local/lib/node_modules/minify/node_modules/gensync/index.js:210:24)
at Generator.next (<anonymous>)
at cachedFunction (/usr/local/lib/node_modules/minify/node_modules/@babel/core/lib/config/caching.js:52:46)
at cachedFunction.next (<anonymous>)
at mergeChainOpts (/usr/local/lib/node_modules/minify/node_modules/@babel/core/lib/config/config-chain.js:349:34)
at mergeChainOpts.next (<anonymous>)
at chainWalker (/usr/local/lib/node_modules/minify/node_modules/@babel/core/lib/config/config-chain.js:316:14)
at chainWalker.next (<anonymous>)
at buildRootChain (/usr/local/lib/node_modules/minify/node_modules/@babel/core/lib/config/config-chain.js:57:36)
at buildRootChain.next (<anonymous>)
at loadPrivatePartialConfig (/usr/local/lib/node_modules/minify/node_modules/@babel/core/lib/config/partial.js:79:62)
at loadPrivatePartialConfig.next (<anonymous>)
at loadFullConfig (/usr/local/lib/node_modules/minify/node_modules/@babel/core/lib/config/full.js:36:46)
at loadFullConfig.next (<anonymous>)
at /usr/local/lib/node_modules/minify/node_modules/@babel/core/lib/transform-ast.js:20:45
at Generator.next (<anonymous>)
at evaluateSync (/usr/local/lib/node_modules/minify/node_modules/gensync/index.js:251:28)
at sync (/usr/local/lib/node_modules/minify/node_modules/gensync/index.js:89:14)
at stopHiding - secret - don't use this - v1 (/usr/local/lib/node_modules/minify/node_modules/@babel/core/lib/errors/rewrite-stack-trace.js:46:12)
at transformFromAstSync (/usr/local/lib/node_modules/minify/node_modules/@babel/core/lib/transform-ast.js:44:83)
at module.exports (/usr/local/lib/node_modules/minify/node_modules/@putout/engine-loader/lib/transforms/babel.js:6:5)
at find (/usr/local/lib/node_modules/minify/node_modules/@putout/engine-loader/lib/wrap-plugin.js:38:9)
at superFind (/usr/local/lib/node_modules/minify/node_modules/@putout/engine-runner/lib/super-find.js:15:25) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/usr/local/lib/node_modules/minify/node_modules/@babel/core/lib/config/files/plugins.js',
'/usr/local/lib/node_modules/minify/node_modules/@babel/core/lib/config/files/index.js',
'/usr/local/lib/node_modules/minify/node_modules/@babel/core/lib/index.js',
'/usr/local/lib/node_modules/minify/node_modules/@putout/engine-loader/lib/transforms/babel.js',
'/usr/local/lib/node_modules/minify/node_modules/@putout/engine-loader/lib/wrap-plugin.js',
'/usr/local/lib/node_modules/minify/node_modules/@putout/engine-loader/lib/load.js',
'/usr/local/lib/node_modules/minify/node_modules/@putout/engine-loader/lib/index.js',
'/usr/local/lib/node_modules/minify/node_modules/putout/lib/putout.js'
]
}```
Side note, the link to @putout/minify in your release note returns 404
Landed support of globally installed modules to 🐊Putout v29.7.0 🎉 . Please reinstall Minify with:
npm i minify -g
Is it works for you?
It does work, but the speed difference is very noticeable. 49 files with 9.2.0 took ~14 seconds, same files on 10.0.0 took ~47 seconds.
That's interesting, could provide example of a file?
Sure. Very tiny file but the difference is already noticeable
jQuery(function ($)
{
var dp;
if (typeof ($.datepicker) != 'undefined')
{
$('#ep_ipo_date').datepicker({
dateFormat: 'yy-mm-dd', changeYear: true, changeMonth: true
});
$('#ep_ipo_date_dp').click(function ()
{
if (($('#ui-datepicker-div').is(':visible') && dp == $(this).attr('id')))
{
$('#ep_ipo_date').datepicker('hide');
dp = null;
}
else
{
$('#ep_ipo_date').datepicker('show');
dp = $(this).attr('id');
}
});
$("#ep_ipo_date").focusout(function ()
{
if (!(/^[\d]{2}\/[\d]{2}\/[\d]{4}$/).test($(this).val()) && $(this).val().length != 0)
{
$(this).val('');
}
});
}
});
How do you run minify
?
Using it like minify test.js > test.min.js
Most of the time spend on loading of 🐊Putout plugins, terser alternative we using right now is pluggable. The best thing we can do is minify all files at once with something like:
minify *.js
Which will create .min.js
files near original.
Or we can run one instance of Minify as server:
minify -s
And make another one to connect to server:
minify 1.js -c
It will speed things up significantly. What do you think about this?
Hmm, in our particular case with files being in different directories and not all of them needing minification, second option seems preferable
Just speed things up in @putout/minify
v1.6.0
. Now all dependencies bundled during publish, so install and load works much faster.
Please re-install Minify
and check how it works now.
Can confirm, it's much much faster now. Thank you!
Starting from v10.2.0
the fastest way to run Minify will be using:
cat example.js | minify --js
Something seems to require
babel-plugin-transform-merge-sibling-variables
which is not being installed automatically. Installing it explicitly still does not solve it. Problem introduced in 10.0.0. Node 19.x/20.x