Questions tagged [laravel-mix]

Laravel Mix provides a fluent API for defining Webpack build steps for your Laravel application using several common CSS and JavaScript pre-processors.

Overview

  • Compiling Assets

    • Stylesheets

      • LESS
      • SASS
      • Stylus
      • PostCSS
      • Plain CSS
    • JavaScripts

      • Vendor Extraction
      • React
      • Vanilla JS
    • Copying files & directories
    • Versioning/Cache Busting
    • Browsersync Reloading

License

MIT

Links

Laravel Docs

Github

1117 questions
91
votes
17 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
  • 2,869
  • 7
  • 34
  • 52
88
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
  • 913
  • 1
  • 6
  • 6
72
votes
13 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,213
  • 1
  • 11
  • 21
44
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,171
  • 2
  • 16
  • 32
42
votes
13 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
  • 2,641
  • 3
  • 13
  • 32
40
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
  • 5,818
  • 29
  • 96
  • 196
27
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
  • 21,294
  • 58
  • 170
  • 304
27
votes
4 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
  • 293
  • 1
  • 3
  • 8
26
votes
8 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
  • 747
  • 2
  • 8
  • 21
22
votes
7 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
  • 5,762
  • 17
  • 59
  • 108
22
votes
3 answers

Laravel Mix: Update a Node.js dependency

I am trying to compile webpack configuration files with Laravel Mix. Following webpack episode on Laracasts Vue 2 series, // Scripts "scripts": { "dev": "node node_modules/cross-env/bin/cross-env.js NODE_ENV=development…
Dazzle
  • 2,196
  • 3
  • 18
  • 40
20
votes
1 answer

Combining Multiple Files with Laravel Mix

I am currently in the process of diving into Laravel Mix and so far, whilst I fully understand what Laravel Mix is and how it works, I am trying to understand a little more about the common practices and 'How-Tos'... For instance, consider this file…
Ben Carey
  • 14,734
  • 16
  • 77
  • 155
19
votes
4 answers

How can I change the public path to something containing an underscore in Laravel Mix?

In Laravel 5.4 Mix was introduced to compile assets and maintain the asset pipeline. Mix defaults to your public directory being named public. In many cases, including mine, my public directory is called something else. In my case, it's…
Mike
  • 8,259
  • 8
  • 41
  • 93
19
votes
5 answers

Laravel 5.4 - Mix - How to run browser live reload

I am using Laravel 5.4 in my project and trying to set up the frontend build system using Mix. Everything is working fine except I could not be able to get browser auto reload option. There is nothing about it on documentation. Someone please help,…
Selim Mahmud
  • 710
  • 1
  • 11
  • 22
18
votes
5 answers

Laravel Mix generate fonts into another directory

I'm using laravel-mix which is built on the top of the webpack. I'm facing a problem with fonts directory. For Example, font-awesome package has a scss file and a font directory where all fonts are placed. font-awesome:. ├───scss │ …
Ven Nilson
  • 473
  • 3
  • 6
  • 27
1
2 3
74 75