* Builds the module using the provided compilation context. * @param {WebpackOptions} options webpack options * @param {Compilation} compilation the compilation * @param {ResolverWithOptions} resolver the resolver * @param {InputFileSystem} fs the file system * @param {BuildCallback} callb
(options, compilation, resolver, fs, callback)
| 903 | * @returns {void} |
| 904 | */ |
| 905 | build(options, compilation, resolver, fs, callback) { |
| 906 | this.buildMeta = { |
| 907 | async: false, |
| 908 | exportsType: undefined |
| 909 | }; |
| 910 | this.buildInfo = { |
| 911 | strict: true, |
| 912 | topLevelDeclarations: new Set(), |
| 913 | javascriptModule: compilation.outputOptions.module |
| 914 | }; |
| 915 | const { request, externalType } = this._getRequestAndExternalType(); |
| 916 | this.buildMeta.exportsType = "dynamic"; |
| 917 | let canMangle = false; |
| 918 | this.clearDependenciesAndBlocks(); |
| 919 | switch (externalType) { |
| 920 | case "this": |
| 921 | this.buildInfo.strict = false; |
| 922 | break; |
| 923 | case "system": |
| 924 | if (!Array.isArray(request) || request.length === 1) { |
| 925 | this.buildMeta.exportsType = "namespace"; |
| 926 | canMangle = true; |
| 927 | } |
| 928 | break; |
| 929 | case "module": |
| 930 | if (this.buildInfo.javascriptModule) { |
| 931 | if (!Array.isArray(request) || request.length === 1) { |
| 932 | this.buildMeta.exportsType = "namespace"; |
| 933 | canMangle = true; |
| 934 | } |
| 935 | } else { |
| 936 | this.buildMeta.async = true; |
| 937 | EnvironmentNotSupportAsyncWarning.check( |
| 938 | this, |
| 939 | compilation.runtimeTemplate, |
| 940 | "external module" |
| 941 | ); |
| 942 | if (!Array.isArray(request) || request.length === 1) { |
| 943 | this.buildMeta.exportsType = "namespace"; |
| 944 | canMangle = false; |
| 945 | } |
| 946 | } |
| 947 | break; |
| 948 | case "script": |
| 949 | this.buildMeta.async = true; |
| 950 | EnvironmentNotSupportAsyncWarning.check( |
| 951 | this, |
| 952 | compilation.runtimeTemplate, |
| 953 | "external script" |
| 954 | ); |
| 955 | break; |
| 956 | case "promise": |
| 957 | this.buildMeta.async = true; |
| 958 | EnvironmentNotSupportAsyncWarning.check( |
| 959 | this, |
| 960 | compilation.runtimeTemplate, |
| 961 | "external promise" |
| 962 | ); |
nothing calls this directly
no test coverage detected