Laravel-mix: [Question] How to extend Laravel Mix API?

Created on 1 Feb 2017  路  5Comments  路  Source: JeffreyWay/laravel-mix

I know that Mix doesn't have any plugin ecosystem #183 , but how could I extend it to support mix.custom? The following code works if added into the index.js file, but couldn't figure out how to make it work through webpack.config.js, any ideas?

module.exports.custom = (src, output) => {
    // Custom logic
};

Most helpful comment

@JeffreyWay While I understand your concern, IMHO it's still better to support some sort of hooks or plugin system, otherwise you left developers no options other than forking the core Mix project for their customizations, which is fine, but still allowing them upload laravel-mix-* is still more appropriate on the ecosystem level. You don't have to support edge cases, yes. But at least leave a room for developers to implement the rest 20% 馃槈 what do you think?

All 5 comments

There are no extension points at the moment. I sort of wanted to avoid the scenario where people start uploading a bunch of laravel-mix-* packages.

I'd rather folks just hook into mix.webpackConfig() to add additional functionality.

@JeffreyWay While I understand your concern, IMHO it's still better to support some sort of hooks or plugin system, otherwise you left developers no options other than forking the core Mix project for their customizations, which is fine, but still allowing them upload laravel-mix-* is still more appropriate on the ecosystem level. You don't have to support edge cases, yes. But at least leave a room for developers to implement the rest 20% 馃槈 what do you think?

Extension points should make the laravel-mix process a lot smoother.

I think if people really need a bunch of Laravel Mix extensions, they should instead use Webpack directly.

Ok, could you point in any direction to create a workaround to the version-issue with laravel-mix. Need to delete all files in the dist folder before a build.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mstralka picture mstralka  路  3Comments

sdebacker picture sdebacker  路  3Comments

stefensuhat picture stefensuhat  路  3Comments

rderimay picture rderimay  路  3Comments

pixieaka picture pixieaka  路  3Comments