* Returns options object. * @param {WebpackOptions} options options object * @param {Compiler} compiler compiler object * @param {WebpackOptionsInterception=} interception intercepted options * @returns {WebpackOptions} options object
(options, compiler, interception)
| 97 | * @returns {WebpackOptions} options object |
| 98 | */ |
| 99 | process(options, compiler, interception) { |
| 100 | compiler.outputPath = options.output.path; |
| 101 | compiler.recordsInputPath = options.recordsInputPath || null; |
| 102 | compiler.recordsOutputPath = options.recordsOutputPath || null; |
| 103 | compiler.name = options.name; |
| 104 | |
| 105 | if (options.externals) { |
| 106 | class="cm">// @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 |
| 107 | const ExternalsPlugin = require(class="st">"./ExternalsPlugin"); |
| 108 | |
| 109 | new ExternalsPlugin(options.externalsType, options.externals).apply( |
| 110 | compiler |
| 111 | ); |
| 112 | } |
| 113 | |
| 114 | if (options.externalsPresets.node) { |
| 115 | const NodeTargetPlugin = require(class="st">"./node/NodeTargetPlugin"); |
| 116 | |
| 117 | class="cm">// Some older versions of Node.js don't support all built-in modules via import, only via `require`, |
| 118 | class="cm">// but it seems like there shouldn't be a warning here since these versions are rarely used in real applications |
| 119 | new NodeTargetPlugin( |
| 120 | options.output.module ? class="st">"module-import" : class="st">"node-commonjs" |
| 121 | ).apply(compiler); |
| 122 | |
| 123 | class="cm">// Handle external CSS `@import` and `url()` |
| 124 | if (options.experiments.css) { |
| 125 | class="cm">// @ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 |
| 126 | const ExternalsPlugin = require(class="st">"./ExternalsPlugin"); |
| 127 | |
| 128 | new ExternalsPlugin( |
| 129 | class="st">"module", |
| 130 | ({ request, dependencyType, contextInfo }, callback) => { |
| 131 | if ( |
| 132 | /\.css(?:\?|$)/.test(contextInfo.issuer) && |
| 133 | /^(?:\/\/|https?:\/\/|#)/.test(request) |
| 134 | ) { |
| 135 | if (dependencyType === class="st">"url") { |
| 136 | return callback(null, `asset ${request}`); |
| 137 | } else if ( |
| 138 | (dependencyType === class="st">"css-import" || |
| 139 | dependencyType === class="st">"css-import-local-module" || |
| 140 | dependencyType === class="st">"css-import-global-module") && |
| 141 | options.experiments.css |
| 142 | ) { |
| 143 | return callback(null, `css-import ${request}`); |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | callback(); |
| 148 | } |
| 149 | ).apply(compiler); |
| 150 | } |
| 151 | } |
| 152 | if (options.externalsPresets.deno) { |
| 153 | const DenoTargetPlugin = require(class="st">"./deno/DenoTargetPlugin"); |
| 154 | |
| 155 | new DenoTargetPlugin().apply(compiler); |
| 156 | } |
nothing calls this directly
no test coverage detected