Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Breaks with NamedModulesPlugin #648

Closed
cletusw opened this issue Oct 16, 2017 · 7 comments
Closed

Breaks with NamedModulesPlugin #648

cletusw opened this issue Oct 16, 2017 · 7 comments

Comments

@cletusw
Copy link

cletusw commented Oct 16, 2017

extract-text-webpack-plugin breaks when combined with webpack.NamedModulesPlugin. It incorrectly outputs the result of extracting the CSS from the first bundle in all assets.

main.css

body {
  background: blue;
}

other.css

body {
  border: 10px solid yellow;
}

becomes

main.built.css

body {
  background: blue;
}

other.built.css

body {
  background: blue;
}

node --version: v8.5.0
npm --version: 5.5.1
npm ls --depth=0:

├── extract-text-webpack-plugin@3.0.1
├── raw-loader@0.5.1
└── webpack@3.7.1

EDIT: Minimal repro case: https://github.com/cletusw/extract-text-webpack-plugin-issue-648

@cletusw
Copy link
Author

cletusw commented Oct 16, 2017

I've verified that it is not this issue. module.libIdent is unique for each module.

@cletusw
Copy link
Author

cletusw commented Oct 16, 2017

Problem could be this line, which is comparing two IDs, one of which is a number and the other is the NamedModulesPlugin-generated ID (ie, ./node_modules/raw-loader/index.js!./main.css). Without the plugin they're both numbers so the if block exectues.

EDIT: Confirmed that if I set the if condition to true to force that block to execute, the problem goes away. I'll need to figure out some way to do a true ID comparison that respects the NamedModulesPlugin.

@cletusw
Copy link
Author

cletusw commented Oct 16, 2017

This line, added in 7fc7957, assumes the first module will have ID 0 instead of a string. Not sure how to fix that.

@sgal
Copy link

sgal commented Oct 17, 2017

Seems like it's a common issue to any ID-generating plugins. #642 could be related.

@sgal
Copy link

sgal commented Oct 19, 2017

Looks like #601 fixes this issue. But for some reason it was abandoned due to lack of review from @sokra

@sokra
Copy link
Member

sokra commented Oct 19, 2017

Sorry

@cletusw
Copy link
Author

cletusw commented Oct 21, 2017

Fix merged: d5a1de2

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

No branches or pull requests

4 participants