guido
Version:
基于webpack4的一键式开发工具,集成handlebars、雪碧图、SVG Sprite、自定义资源注入等方式
22 lines (17 loc) • 427 B
JavaScript
;
const path = require('path');
const matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
function escape(str) {
if (typeof str !== 'string') {
throw new TypeError('Expected a string');
}
return str.replace(matchOperatorsRe, '\\$&');
}
module.exports = function ignoredFiles(dirPath) {
return new RegExp(
`^(?!${escape(
path.normalize(dirPath + '/').replace(/[\\]+/g, '/')
)}).+/node_modules/`,
'g'
);
};