(fixture, config = {}, options = {})
| 52 | * @returns {Configuration} build configuration |
| 53 | */ |
| 54 | export default function getCompiler(fixture, config = {}, options = {}) { |
| 55 | // webpack Config |
| 56 | config = { |
| 57 | cache: config.cache || false, |
| 58 | mode: config.mode || "development", |
| 59 | devtool: config.devtool || false, |
| 60 | // context: path.resolve(__dirname, '..', 'fixtures'), |
| 61 | context: path.resolve(__dirname, ".."), |
| 62 | entry: config.entry || `./${fixture}`, |
| 63 | output: output(config), |
| 64 | module: module(config), |
| 65 | plugins: plugins(config), |
| 66 | optimization: { |
| 67 | runtimeChunk: false, |
| 68 | minimizer: [], |
| 69 | }, |
| 70 | |
| 71 | resolve: config.resolve || undefined, |
| 72 | }; |
| 73 | |
| 74 | // Compiler Options |
| 75 | options = { output: false, ...options }; |
| 76 | |
| 77 | if (options.output) { |
| 78 | deleteSync(config.output.path); |
| 79 | } |
| 80 | |
| 81 | const compiler = webpack(config); |
| 82 | |
| 83 | if (!options.output) { |
| 84 | compiler.outputFileSystem = createFsFromVolume(new Volume()); |
| 85 | } |
| 86 | |
| 87 | return compiler; |
| 88 | } |
searching dependent graphs…