mirror of https://github.com/webpack/webpack.git
23 lines
462 B
JavaScript
23 lines
462 B
JavaScript
const fs = require("fs");
|
|
|
|
module.exports = {
|
|
noTests: true,
|
|
findBundle(i, options) {
|
|
const regex = new RegExp(`^bundle.${options.name}`, "i");
|
|
const files = fs.readdirSync(options.output.path);
|
|
const bundle = files.find(function (file) {
|
|
return regex.test(file);
|
|
});
|
|
|
|
if (!bundle) {
|
|
throw new Error(
|
|
`No file found with correct name (regex: ${
|
|
regex.source
|
|
}, files: ${files.join(", ")})`
|
|
);
|
|
}
|
|
|
|
return `./${bundle}`;
|
|
}
|
|
};
|