JSPM

laravel-mix-alias

1.0.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1519
  • Score
    100M100P100Q119202F
  • License MIT

A Laravel Mix extension for Webpack alias support.

Package Exports

  • laravel-mix-alias

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (laravel-mix-alias) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Laravel Mix Alias

Add aliases to your source files.

Requirements

⚠️ ⚠️ Only use this package with Laravel Mix v5 and below! The alias function was added to the core of v6. ⚠️ ⚠️

Installation

npm install laravel-mix-alias --save

or

yarn add laravel-mix-alias

Usage

Your webpack.mix.js could look like this:

const mix = require('laravel-mix');
require('laravel-mix-alias');

mix.alias({
    '@': '/resources/js',
    '~': '/resources/sass',
});

or add them one by one

const mix = require('laravel-mix');
require('laravel-mix-alias');

mix.alias('@', '/resources/js');
mix.alias('~', '/resources/sass');

Now you can import sass files from the path you specified

@import "~/variables";

Or import scripts from the path you specified

import '@/script.js';

Author

Maxim Vanhove Web developer at Starring Jane

Twitter Follow