easy-mix-extension

Easy Laravel Mix Extension

Usage no npm install needed!

<script type="module">
  import easyMixExtension from 'https://cdn.skypack.dev/easy-mix-extension';
</script>

README

Easy Laravel Mix Extension

NPM NPM NPM

Introduction

This extension will add some handy shortcuts for frequently used modification for Laravel Mix.

Table of Contents

  1. Installation
  2. Documentation
  3. Use
  4. Issues & Contribution
  5. License

Installation

Installation after successfully installed Laravel Mix. Simply execute the following command line:

NPM Command

npm i -D easy-laravel-mix

Require the Package

The package can be simply required within your webpack.mix.js file:

const mix = require('laravel-mix')

// Add the following line:
require('easy-mix-extension')

mix...

Dokumentation

The following configurations are currently available:

|Configuration Name|Description| |-|-| |alias|Add import aliases like import('@/App.vue'))| |dynamic-import|Shorthand configuration for @babel/plugin-syntax-dynamic-import
(Used for Vue 3 chunks)|

alias

Easy configuration for import aliases starting from the entry file.

mix.easy('alias')
mix.easy('alias', { '@': '/' }) // default
mix.easy('alias', {
    '@': '/',
    '@components': 'components',
})

dynamic-import

Configuration for the @babel/plugin-syntax-dynamic-import plugin. The given directory will be relative to your output directory.

mix.easy('dynamic-import')
mix.easy('dynamic-import', 'chunks') // default

Use

The Easy Laravel Mix Extension is build with super easy use in mind.

You can pass each config separately, as an array or an object with additional configuration.

Here are some examples:

// Separat Declaration
mix.easy('sample-1')
mix.easy('sample-2')
mix.easy('sample-3', 'value')

// Array Declaration
mix.easy(['sample-1', 'sample-2'])

// Object Declaration
mix.easy({
    'sample-3': 'value',
})

Issues & Contribution

For any kind of Issue with this project feel free to open up a new topic in its GitHub Issue.

If you would like to contribute to this project or add your own configuration you are welcome! Please add a pull-request, so I can curate your addition.

License

Easy Laravel Mix Extension is open-sourced software licensed under the MIT license.