|
1 | 1 | /*
|
| 2 | +/* (C) Copyright HCL Technologies Ltd. 2018 |
2 | 3 | * (C) Copyright IBM Corp. 2012, 2016 All Rights Reserved.
|
3 | 4 | *
|
4 | 5 | * Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -43,14 +44,13 @@ module.exports = class DojoAMDModuleFactoryPlugin {
|
43 | 44 | "resolver" : this.resolver,
|
44 | 45 | "create-module" : this.createModule
|
45 | 46 | }, context);
|
46 |
| - tap(compiler, {"compilation" : (compilation, params) => { |
47 |
| - tap(factory, "module", this.module, Object.create(context, { |
48 |
| - compilation: {value: compilation}, |
49 |
| - params: {value: params} |
50 |
| - })); |
51 |
| - }}); |
52 |
| - }, this); |
53 |
| - } |
| 47 | + }); |
| 48 | + tap(compiler, {"compilation" : (compilation, params) => { |
| 49 | + tap(params.normalModuleFactory, { |
| 50 | + "module": this.module.bind(this, compilation, params.normalModuleFactory) |
| 51 | + }); |
| 52 | + }}); |
| 53 | +} |
54 | 54 |
|
55 | 55 | toAbsMid(request, issuerAbsMid, dojoRequire) {
|
56 | 56 | var result = request;
|
@@ -210,29 +210,29 @@ module.exports = class DojoAMDModuleFactoryPlugin {
|
210 | 210 | return module;
|
211 | 211 | }
|
212 | 212 |
|
213 |
| - module(module) { |
| 213 | + module(compilation, moduleFactory, module) { |
214 | 214 | if (module.originalRequest instanceof Module) {
|
215 | 215 | // Copy absMids from original request to the new request
|
216 |
| - callSync(this.factory, "filter absMids", module.originalRequest, absMid => { |
217 |
| - callSync(this.factory, "add absMid", module, absMid); |
| 216 | + callSync(moduleFactory, "filter absMids", module.originalRequest, absMid => { |
| 217 | + callSync(moduleFactory, "add absMid", module, absMid); |
218 | 218 | return true;
|
219 | 219 | });
|
220 | 220 | }
|
221 | 221 | // If the module already exists in the compilation, then copy the absMid data from
|
222 | 222 | // this module to the existing module since this module will be discarded
|
223 |
| - const existing = this.compilation.findModule(module.request); |
| 223 | + const existing = compilation.findModule(module.request); |
224 | 224 | if (existing) {
|
225 |
| - callSync(this.factory, "filter absMids", module, absMid => { |
226 |
| - callSync(this.factory, "add absMid", existing, absMid); |
| 225 | + callSync(moduleFactory, "filter absMids", module, absMid => { |
| 226 | + callSync(moduleFactory, "add absMid", existing, absMid); |
227 | 227 | return true;
|
228 | 228 | });
|
229 | 229 | }
|
230 | 230 | // Add functions to the module object for adding/filtering absMids (for use by loaders)
|
231 | 231 | module.addAbsMid = absMid => {
|
232 |
| - callSync(this.factory, "add absMid", module, absMid); |
| 232 | + callSync(moduleFactory, "add absMid", module, absMid); |
233 | 233 | };
|
234 | 234 | module.filterAbsMids = callback => {
|
235 |
| - callSync(this.factory, "filter absMids", module, callback); |
| 235 | + callSync(moduleFactory, "filter absMids", module, callback); |
236 | 236 | };
|
237 | 237 | return module;
|
238 | 238 | }
|
|
0 commit comments