Skip to content

Commit

Permalink
add note about webpack 5 refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Jun 23, 2018
1 parent 3fb49de commit e1f0a66
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/dependencies/DependencyReference.js
Expand Up @@ -7,6 +7,9 @@
/** @typedef {import("../Module")} Module */

class DependencyReference {
// TODO webpack 5: module must be dynamic, you must pass a function returning a module
// This is needed to remove the hack in ConcatenatedModule
// The problem is that the `module` in Dependency could be replaced i. e. because of Scope Hoisting
/**
*
* @param {Module} module the referenced module
Expand All @@ -15,6 +18,7 @@ class DependencyReference {
* @param {number} order the order information or NaN if don't care
*/
constructor(module, importedNames, weak = false, order = NaN) {
// TODO webpack 5: make it a getter
this.module = module;
// true: full object
// false: only sideeffects/no export
Expand Down
1 change: 1 addition & 0 deletions lib/optimize/ConcatenatedModule.js
Expand Up @@ -429,6 +429,7 @@ class ConcatenatedModule extends Module {
})
.filter(ref => ref);
DependencyReference.sort(references);
// TODO webpack 5: remove this hack, see also DependencyReference
return references.map(ref => {
const dep = map.get(ref);
return () => dep.getReference().module;
Expand Down

0 comments on commit e1f0a66

Please sign in to comment.