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

Support chunk sorting options #131

Open
JakeGinnivan opened this issue Sep 3, 2018 · 5 comments
Open

Support chunk sorting options #131

JakeGinnivan opened this issue Sep 3, 2018 · 5 comments

Comments

@JakeGinnivan
Copy link

It would be awesome to support sorting of the chunks, similar to https://github.com/jantimon/html-webpack-plugin/blob/master/lib/chunksorter.js

I currently use this plugin to create the assets and would like to automatically be able to include the appropriate script tags during SSR in the correct order automatically.

This could probably also supersede the manifestFirst option?

@ztoben
Copy link
Owner

ztoben commented Sep 7, 2018

I think this would be a pretty major change as it would require the output to be wrapped in an array or some sortable structure instead of an object.

Not opposed to it, just would require some planning and a major release.

@reddogaw
Copy link

At worst, could a sort order index attribute be output as a property and leave the sorting up to the file consumer.

{
  "runtime": {
    "js": "runtime.913f0ed272c4b1c945f9.js",
    "sortOrder": 0
  },
  "main": {
    "js": "main.edc1ff76e4c8be6f4c81.js",
    "sortOrder": 3
  },
  "polyfills": {
    "js": "polyfills.ab67acf99a82d53b562f.js",
    "sortOrder": 1
  },
  "styles": {
    "css": "styles.03caaa68356691cce406.css",
    "sortOrder": 0
  },
  "scripts": {
    "js": "scripts.48544e4b8eb1ac0cceaa.js",
    "sortOrder": 2
  }
}

@ztoben
Copy link
Owner

ztoben commented Nov 26, 2018

Yeah, that would be a good way to do it. Happy to review any PRs. A little too busy right now to do it myself.

@thiemeljiri
Copy link

What is the current order based on? It's not aplhabetical, it's not the same as the order reported by webpack in console (entry points, then chunks). Thanks.

@ztoben
Copy link
Owner

ztoben commented Jan 18, 2019

There isn't any set order, outside of setting the manifestFirst option. If you want to follow it through the code, you could probably start here: https://github.com/ztoben/assets-webpack-plugin/blob/master/lib/output/createOutputWriter.js#L59

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

No branches or pull requests

4 participants