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

WIP: Multiple build support #3096

Draft
wants to merge 16 commits into
base: next
Choose a base branch
from
Draft

WIP: Multiple build support #3096

wants to merge 16 commits into from

Conversation

thecrypticace
Copy link
Collaborator

@thecrypticace thecrypticace commented Sep 11, 2021

This is a work in progress — much is still broken and all features documented or otherwise are subject to change

I'm opening this PR now to solicit feedback from any passersby about features and needed functionality.


Support for multiple builds via "Build Groups"

Build groups are separate named configurations inside a single webpack.mix.js file. A build group can define it's own assets, behavior, plugins, webpack config, etc. The builds of which are processed independently.

Defining build groups

Defining a build group requires calling mix.group with two arguments: a name and a callback. Providing a name allows you to tell Mix to only build a specific group (or set of groups). Build group names are case insensitive. It is an error to define the same group multiple times. You may use any name you like for a group including spaces but we recommend slug-like names separated by hyphens or underscores.

The example below defines two separate builds for app1 and app2 that can be built independent of one another.

mix.group("app1", (mix) => {
    mix.js("src/app1/js/index.js", "dist/app1.js")
    mix.css("src/app1/css/index.css", "dist/app1.css")
})

mix.group("app2", (mix) => {
    mix.js("src/app2/js/index.js", "dist/app2.js")
    mix.css("src/app2/css/index.css", "dist/app2.css")
    mix.options({
        processCssUrls: false,
    })
})

Manifest & Versioning

Manifest generation & versioning will be completely re-tooled to run entirely through webpack. This should eliminate any hash differences between generated chunks in webpack and when versioned separately by Mix. This also means that we will automatically merge the manifest across multiple builds when shared. However each build can have its own manifest by setting a different name via mix.options.

Handling Mix Extensions / Components

This is still very much up in the air but the thought is right now that we'll instantiate an extension/component once per build group so they can keep their state local to a single group.

@meshakeeb
Copy link

How soon we be seeing this in production builds?

@thecrypticace
Copy link
Collaborator Author

I'm not certain at the moment. I work on Mix in my spare time. There's still plenty I need to figure out here.

@meshakeeb
Copy link

meshakeeb commented Sep 27, 2021

I never worked on laravel mix let me know how to help you to speedup this PR I need it in one of my project. If possible can you make a TODO list and I will work with you to get this into production

@thecrypticace
Copy link
Collaborator Author

@meshakeeb heh yeah there's still quite a bit to do here. I don't have a definitive todo list but I don't expect this feature to be merged for a while. There's a lot of testing and tweaks that have to be done. It's likely this will go through a pretty heavy beta cycle as well.

I don't have a definitive todo list but it is something I need to think more about and write down

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

Successfully merging this pull request may close these issues.

None yet

2 participants