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

Allow from to be array of paths / glob, respect order #631

Open
emkayy opened this issue Oct 11, 2021 · 10 comments
Open

Allow from to be array of paths / glob, respect order #631

emkayy opened this issue Oct 11, 2021 · 10 comments

Comments

@emkayy
Copy link

emkayy commented Oct 11, 2021

Feature Proposal

Please allow the from property to contain an array of paths / glob patterns
because I need to include files from several different locations and copy them all into one folder.
This is quite ugly and verbose doing it with glob.

The assets array in transformAll should then be returned in the order of the from array so you can rely on javascript execution order.

Feature Use Case

Copying and or concatenating and transforming (javascript) files from multiple locations into one file / folder.

Please paste the results of npx webpack-cli info here, and mention other relevant information

not relevant

@alexander-akait
Copy link
Member

Respecting order is very bad for perf, work is going on on different cores, please sort them inside transformAll as you want, sorry, we don't want to implement this

@emkayy
Copy link
Author

emkayy commented Oct 11, 2021

Hi, I don't see how this would affect performance. The array is already getting sorted (

assets.sort((a, b) =>
)
Only the sorting logic would need te be changed so it does sort according to the input order.

@alexander-akait
Copy link
Member

Because this logic don't know nothing about of input order

@emkayy
Copy link
Author

emkayy commented Oct 11, 2021

Well, actually it does:


item does contain the from property and if from is an array, the sort method has access to the input order.

@alexander-akait
Copy link
Member

Try to implement this and PR welcome

@emkayy
Copy link
Author

emkayy commented Oct 12, 2021

I thought you are offering feature requests here?

@alexander-akait
Copy link
Member

I don't understand why you need order by patterns, your order already the same, what is point to do unnecessary calculations

@emkayy
Copy link
Author

emkayy commented Oct 12, 2021

This feature request basically consists of 2 parts:

1. from as an array

  • This would make copying from different locations to one destination a lot easier
  • Only an array enables the transformAll method to keep the output in the same order as the input

... which brings me to the 2nd part:

2. Ordering of the transformAll parameter assets

  • This is important for concatenating CSS and JS files, as both heavily rely on code order (CSS: overriding selectors, JS: execution order)

@alexander-akait
Copy link
Member

from as an array

Yes, we can do it, make sense, but why do not use blog base above and using filter function, better DX?

@alexander-akait
Copy link
Member

Anyway it is low priority, so PR welcome

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

2 participants