Questions tagged [laravel-mix]

Laravel Mix provides a clean, fluent API for defining basic webpack build steps for your applications. Mix supports several common CSS and JavaScript pre-processors.

Laravel Mix provides a clean, fluent API for defining basic webpack build steps for your applications. Mix supports several common CSS and JavaScript pre-processors.

If you've ever been confused about how to get started with module bundling and asset compilation, you will love Laravel Mix!

Overview

  • Working With Stylesheets
    • Tailwind
    • CSS
    • PostCSS
    • Sass
    • URL Processing
    • Source Maps
  • Working With JavaScript
    • Vue
    • React
    • Vendor Extraction
    • Custom Webpack Configuration

License

MIT

Laravel Mix documentation

Laravel documentation

GitHub

1362 questions
115
votes
10 answers

Laravel Mix "sh: 1: cross-env: not found error"

I have been trying to set up Laravel Mix in my project and followed the install guide on the Laravel website however keep getting errors. My package.json { "private": true, "scripts": { "dev": "cross-env NODE_ENV=development webpack…
GregorChristie
  • 1,183
  • 2
  • 8
  • 7
106
votes
18 answers

Laravel 5.4 ‘cross-env’ Is Not Recognized as an Internal or External Command

I'm trying to run npm run dev for Laravel Mix and I get this error: > @ dev D:\projects\ptcs > cross-env NODE_ENV=development webpack --progress --hide-modules -- config=node_modules/laravel-mix/setup/webpack.config.js 'cross-env' is not recognized…
Arthur Tarasov
  • 3,517
  • 9
  • 45
  • 57
82
votes
14 answers

How to Install Font Awesome in Laravel Mix

I've tried to install Font Awesome using Laravel Mix but when executing run npm dev I get the following message: ERROR Failed to compile with 1 errors error in ./~/font-awesome/scss/font-awesome.scss Module build failed: /** ^ Invalid CSS…
Lucas Lopes
  • 1,373
  • 3
  • 14
  • 23
70
votes
32 answers

The Mix manifest does not exist when it does exist

For my admin panel I extract all the assets including the manifest-json.js to mix.setPublicPath(path.normalize('public/backend/')). All the files get correctly added to the backend folder, and the manifest-json.js file looks as follows: { // all…
Chris
  • 3,311
  • 4
  • 20
  • 34
62
votes
7 answers

'mix' is not recognized as an internal or external command in Laravel 8 new installation

I have installed a new Laravel 8 application, and then I ran... npm install Afterward, I ran... npm run dev I get the following error. 'mix' is not recognized as an internal or external command > @ dev…
Spiral
  • 917
  • 1
  • 9
  • 15
49
votes
2 answers

Difference between npm run watch and npm run watch-poll

What is the difference between npm run watch and npm run watch-poll in Laravel mix? I cannot see any difference between the output they give.
Advaith
  • 2,490
  • 3
  • 21
  • 36
42
votes
7 answers

Block-scoped declarations not yet supported outside strict mode

I'm running Laravel 5.4 on my Homestead vagrant box. I've installed all the npm dependencies with npm install command. That didn't produce any errors. In my webpack.min.js file I have: const { mix } = require('laravel-mix'); /* …
nielsv
  • 6,540
  • 35
  • 111
  • 215
41
votes
6 answers

npm run cannot find module 'sass' after repeated reinstall attempts

Any call to npm run produces this error: $ npm run dev > @ dev /project > npm run development > @ development /project > cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules…
eComEvo
  • 11,669
  • 26
  • 89
  • 145
39
votes
6 answers

'cross-env' is not recognized as an internal or external command,

Guys can you please help me on this I have trouble run npm run dev for my Laravel Mix. I followed links below but still error exist. Do i have a problem on my OS? I tried to remove node_modules, run npm install --global cross-env. and run NPM…
Jesray Garciano
  • 413
  • 1
  • 4
  • 9
39
votes
10 answers

Enable inline javascript in LESS

I would like to use inline js in my less files but I get the following message: Inline JavaScript is not enabled. Is it set in your options? How can I enable that?
pharkasbence
  • 957
  • 3
  • 9
  • 25
37
votes
8 answers

92% chunk asset optimization - webpack

It seems that webpack gets stuck on 92% chunk asset optimization for about 30+ seconds to show a simple js/css change. This is too long for anyone sane to sit and wait that much of their life to see something that should be rendered near…
Wonka
  • 8,244
  • 21
  • 73
  • 121
32
votes
4 answers

Laravel Mix unknown option '--hide-modules' error

When I try to compile React component with Laravel Mix in my Laravel project it raises error 2 lifecycle. E:\MY PROJECTS\Samriddhi Institute> npm run dev @ dev E:\MY PROJECTS\Samriddhi Institute npm run development @ development E:\MY…
Ravi Majithiya
  • 321
  • 1
  • 3
  • 3
32
votes
1 answer

How to include webpack plugins when using Laravel Mix?

How should I include webpack plugins if I use WebPack AND Laravel Mix? I am confused which file I add the plugin code into. My below attempt doesn't seem to be running my plugin. The plugin should be compressing the js, css files but its…
sazr
  • 24,984
  • 66
  • 194
  • 362
30
votes
10 answers

Laravel, NPM: Command "mix" not found

Does anyone have an idea why it throws the following error and how to fix it? I have also tried to reinstall all packages using npm install several times. Reinstalling NodeJS on Windows didn't work; I'm using Laravel 8.22.0. Full Log 0 verbose cli…
Pinnokkio
  • 439
  • 1
  • 5
  • 10
26
votes
2 answers

What Are "npm run dev" and "npm run prod"

I use the following command to bundle my scripts via the Laravel Mix module: npm run dev // Compile scripts. npm run prod // Compile and minify scripts. Are these native npm commands or custom Laravel Mix commands? Where are they defined? I…
GTS Joe
  • 3,612
  • 12
  • 52
  • 94
1
2 3
90 91