版本对比工具
npm install --save versions-compare
var compare = require('versions-compare');
compare(1, 2); // -1
compare([1, 2], [1, 3]); // -1
compare('1.2.3', '1.4.1'); // -1
compare('1.1.1', '1.1.1'); // 0
compare('1.2.3', [1, 2, 3]); // 0
compare('1.2', 2); // -1
compare(3, [2, 3, 4]); // -1
compare('1.0.1', '1'); // 1
compare('1.1.', [1, 2, 3]); // Wrong Params.
compare('.1.1', [1, 2, 3]); // Wrong Params.
import path from 'path';
export default {
//...
plugins: [{
resolveId(id) {
if (id.startsWith('versions-compare')) {
return path.resolve(`${yourPath}/versions-compare/src/index.umd.js`);
}
return null;
}
}],
//...
}
module.exports = {
//...
resolve: {
alias: {
"versions-compare": "versions-compare/src/index.umd.js"
}
}
};