Skip to content
This repository was archived by the owner on Sep 7, 2026. It is now read-only.
This repository was archived by the owner on Sep 7, 2026. It is now read-only.

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

Open

Description

@emkayy

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

Activity

  1. alexander-akait commented on Oct 11, 2021

    @alexander-akait
    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

  2. emkayy commented on Oct 11, 2021

    @emkayy
    Author

    Hi, I don't see how this would affect performance. The array is already getting sorted (https://github.com/webpack-contrib/copy-webpack-plugin/blob/beff64eff0f070632d0e5f587b2afee766d3c1fa/src/index.js#L648)
    Only the sorting logic would need te be changed so it does sort according to the input order.

  3. alexander-akait commented on Oct 11, 2021

    @alexander-akait
    Member

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

  4. emkayy commented on Oct 11, 2021

    @emkayy
    Author

    Well, actually it does:
    https://github.com/webpack-contrib/copy-webpack-plugin/blob/beff64eff0f070632d0e5f587b2afee766d3c1fa/src/index.js#L627
    item does contain the from property and if from is an array, the sort method has access to the input order.

  5. alexander-akait commented on Oct 11, 2021

    @alexander-akait
    Member

    Try to implement this and PR welcome

  6. emkayy commented on Oct 12, 2021

    @emkayy
    Author

    I thought you are offering feature requests here?

  7. alexander-akait commented on Oct 12, 2021

    @alexander-akait
    Member

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

  8. emkayy commented on Oct 12, 2021

    @emkayy
    Author

    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)
  9. alexander-akait commented on Oct 12, 2021

    @alexander-akait
    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?

  10. alexander-akait commented on Oct 12, 2021

    @alexander-akait
    Member

    Anyway it is low priority, so PR welcome

  11. added a commit that references this issue on Nov 23, 2021
    3cb90e1
  12. added 4 commits that reference this issue on Mar 18, 2026
    b72882e
    236b932
    98ecd34
    87f84b5
  13. added a commit that references this issue on Apr 4, 2026
    8fdf7d9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions