[Question] How to extend Laravel Mix API?
See original GitHub issueI 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:
- Created 7 years ago
- Comments:5 (1 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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?
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.