* @private * @returns {Compiler["options"]} compiler options
()
| 797 | * @returns {Compiler["options"]} compiler options |
| 798 | */ |
| 799 | getCompilerOptions() { |
| 800 | if ( |
| 801 | typeof (/** @type {MultiCompiler} */ (this.compiler).compilers) !== |
| 802 | "undefined" |
| 803 | ) { |
| 804 | if (/** @type {MultiCompiler} */ (this.compiler).compilers.length === 1) { |
| 805 | return ( |
| 806 | /** @type {MultiCompiler} */ |
| 807 | (this.compiler).compilers[0].options |
| 808 | ); |
| 809 | } |
| 810 | |
| 811 | // Configuration with the `devServer` options |
| 812 | const compilerWithDevServer = |
| 813 | /** @type {MultiCompiler} */ |
| 814 | (this.compiler).compilers.find((config) => config.options.devServer); |
| 815 | |
| 816 | if (compilerWithDevServer) { |
| 817 | return compilerWithDevServer.options; |
| 818 | } |
| 819 | |
| 820 | // Configuration with `web` preset |
| 821 | const compilerWithWebPreset = |
| 822 | /** @type {MultiCompiler} */ |
| 823 | (this.compiler).compilers.find((config) => Server.isWebTarget(config)); |
| 824 | |
| 825 | if (compilerWithWebPreset) { |
| 826 | return compilerWithWebPreset.options; |
| 827 | } |
| 828 | |
| 829 | // Fallback |
| 830 | return /** @type {MultiCompiler} */ (this.compiler).compilers[0].options; |
| 831 | } |
| 832 | |
| 833 | return /** @type {Compiler} */ (this.compiler).options; |
| 834 | } |
| 835 | |
| 836 | /** |
| 837 | * @private |
no test coverage detected