| | |
| | | /** @typedef {import("../Compiler")} Compiler */ |
| | | |
| | | /** |
| | | * Defines the read file compile wasm plugin options type used by this module. |
| | | * @typedef {object} ReadFileCompileWasmPluginOptions |
| | | * @property {boolean=} mangleImports mangle imports |
| | | * @property {boolean=} import use import? |
| | |
| | | |
| | | class ReadFileCompileWasmPlugin { |
| | | /** |
| | | * Creates an instance of ReadFileCompileWasmPlugin. |
| | | * @param {ReadFileCompileWasmPluginOptions=} options options object |
| | | */ |
| | | constructor(options = {}) { |
| | | /** @type {ReadFileCompileWasmPluginOptions} */ |
| | | this.options = options; |
| | | } |
| | | |
| | | /** |
| | | * Apply the plugin |
| | | * Applies the plugin by registering its hooks on the compiler. |
| | | * @param {Compiler} compiler the compiler instance |
| | | * @returns {void} |
| | | */ |
| | |
| | | compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => { |
| | | const globalWasmLoading = compilation.outputOptions.wasmLoading; |
| | | /** |
| | | * Checks whether this read file compile wasm plugin is enabled for chunk. |
| | | * @param {Chunk} chunk chunk |
| | | * @returns {boolean} true, when wasm loading is enabled for the chunk |
| | | */ |