question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Question] How to extend Laravel Mix API?

See original GitHub issue

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
};

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

8reactions
Omraniccommented, Feb 1, 2017

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

3reactions
JeffreyWaycommented, Feb 1, 2017

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Question] How to extend Laravel Mix API? · Issue #256 - GitHub
I think if people really need a bunch of Laravel Mix extensions, they should instead use Webpack directly. 1
Read more >
Extending Mix | Laravel Mix Documentation
Build a Simple Plugin​​ mix. js; let mix = require('laravel-mix'); mix. extend('foo', function(webpackConfig, ... args) { // The webpack configuration object.
Read more >
Learn Laravel Mix: Mix Extension Essentials
Laravel Mix 2.1 and up includes support for custom user extensions. ... In this episode, we'll learn the basics of the API.
Read more >
Compiling Assets (Laravel Mix)
If you would like completely customize your Webpack configuration, copy the node_modules/laravel-mix/setup/webpack.config.js file to your project's root ...
Read more >
cannot @extend third party css framework in scss with Laravel ...
cannot @extend third party css framework in scss with Laravel Mix · Ask Question. Asked 2 years, 1 month ago. Modified 5 months...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found