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

Webpack3 generate css in wrong order #5106

Closed
ohmyhusky opened this issue Jun 20, 2017 · 6 comments
Closed

Webpack3 generate css in wrong order #5106

ohmyhusky opened this issue Jun 20, 2017 · 6 comments

Comments

@ohmyhusky
Copy link

ohmyhusky commented Jun 20, 2017

Do you want to request a feature or report a bug?
bug

What is the current behavior?
When using extract-text-webpack-plugin with webpack3 to generate stylesheet file, the content's order doesn't obey source code's order. Use create-react-app boilerplate to explain this :

// App.js
import React, { Component } from "react";
import Block from "./Block";
import "./App.css";

class App extends Component {
  render() {
    return (
      <div className="App">
        <Block />
      </div>
    );
  }
}

export default App;
//Block.js
import React from "react";
import "./block.css";

export default () => <div className="block">Content</div>;

// App.css
.App {
  text-align: center;
}
// block.css
.block {
  font-size: 16px;
}

Got :

.App {
  text-align: center;
}.block {
  font-size: 16px;
}
/*# sourceMappingURL=main.f2db6320.css.map*/

I'm not sure if this problem is webpack3 or extract-text-webpack-plugin's problem, since I can get correct result in webpack2.6.1, I think I should post in here first.
If the current behavior is a bug, please provide the steps to reproduce.

The complete project : https://github.com/cyl19910101/wp3_test

What is the expected behavior?
Expected stylesheet order :

.block {
  font-size: 16px;
}.App {
  text-align: center;
}

If this is a feature request, what is motivation or use case for changing the behavior?

Please mention other relevant information such as the browser version, Node.js version, webpack version and Operating System.

OS :

ProductName:    Mac OS X
ProductVersion: 10.12.5
BuildVersion:   16F73

Node :

v8.1.2

Webpack :

3.0.0
@moimael
Copy link

moimael commented Jun 20, 2017

extract-text-webpack-plugin has a ignoreOrder option. It's false by default but maybe you activated it ?

@phun-ky
Copy link

phun-ky commented Jun 20, 2017

I have the same issue. Just upgraded to webpack@3.0.0, and the css is in wrong order. ignoreOrder is not touched here.

@polco
Copy link

polco commented Jun 20, 2017

same here

@ohmyhusky
Copy link
Author

@moimael I didn't touch the ignoreOrder option. And I've tried to set it to false specifically after read your comment, still get the same output.

@sokra
Copy link
Member

sokra commented Jun 20, 2017

@webpack-bot move to webpack-contrib/extract-text-webpack-plugin

extractedChunk.modules.sort is no longer valid, as extractedChunk.modules is now a getter to extractedChunk._modules which is a Set.

@webpack-bot
Copy link
Contributor

I've moved it to webpack-contrib/extract-text-webpack-plugin.

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

6 participants