dool-build
Version:
d-band tool & dev tool
42 lines (35 loc) • 1.65 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var CssEntryPlugin = function () {
function CssEntryPlugin() {
_classCallCheck(this, CssEntryPlugin);
}
_createClass(CssEntryPlugin, [{
key: 'apply',
value: function apply(compiler) {
compiler.plugin('emit', function (compilation, callback) {
compilation.chunks.filter(function (chunk) {
return (/\.css$/i.test(chunk.name)
);
}).forEach(function (chunk) {
// remove unused js files
chunk.files = chunk.files.filter(function (file) {
var isJS = /\.js(|\.map)$/i.test(file);
if (isJS) {
delete compilation.assets[file];
}
return isJS;
});
});
callback();
});
}
}]);
return CssEntryPlugin;
}();
exports.default = CssEntryPlugin;
module.exports = exports['default'];