Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About mini-css-extract-plugin compatible #481

Open
Beven91 opened this issue Jan 14, 2019 · 1 comment
Open

About mini-css-extract-plugin compatible #481

Beven91 opened this issue Jan 14, 2019 · 1 comment

Comments

@Beven91
Copy link

Beven91 commented Jan 14, 2019

Expected Behavior

The mini-css-extract-plugin should be cached well when webpack is hot built。

Actual Behavior

Cause Error Could not freeze xxx/xx.scss Cannot read property 'hash' of undefined

Maybe Question

The event _hardSourceFreezeModule is not compatible when webpack is hot built scss( use mini-css-extract-plugin)。

With code:

 if (module.request &&
          (cacheable(module) || !module.built) &&
          module instanceof NormalModule &&
          (!frozen ||
            (schema >= 4 && module.hash !== frozen.build.hash) ||
            (schema < 4 &&
              module.getHashDigest(extra.compilation.dependencyTemplates) !==
                frozen.hash))
)

And segment:

module.hash !== frozen.build.hash

Scenes

The scss module hash was changed ,but the module maybe not be built (module.built===false)。

let serialModule = serialNormalModule;
if (!module.built) {
  serialModule = serialNormalModule4PreBuild;
}

And only try this code

let serialModule = serialNormalModule;
if (!module.built) {
  if (module.hash) {
    return null;
  }
  serialModule = serialNormalModule4PreBuild;
}

It's could work。

But this maybe not a foundmental problem, just a possibility。

@sk91
Copy link

sk91 commented Feb 25, 2019

👍 happens to me as well
screen shot 2019-02-25 at 18 26 23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants