Laravel-mix: npm run hot does not build files.

Created on 28 Mar 2017  路  4Comments  路  Source: JeffreyWay/laravel-mix

  • Laravel Mix Version: 0.9.2
  • Node Version 7.7.4:
  • NPM Version 4.1.1:
  • OS: Windows 10 Pro

Description:

npm run hot does not build files neither watch them.

 DONE  Compiled successfully in 7267ms                                                                                                 19:41:07
[BS] Proxying: http://vividlx.dev
[BS] Access URLs:
 --------------------------------------
       Local: http://localhost:3000
    External: http://192.168.10.44:3000
 --------------------------------------
          UI: http://localhost:3001
 UI External: http://192.168.10.44:3001
 --------------------------------------
[BS] Watching files...

But i still have 404 not found and by js and css directorys wont change.

Steps To Reproduce:

If someone would like to see the code i can give him access to private repo.

My mix file

const { mix } = require('laravel-mix'),
    axis = require('axis'),
    ModernizrWebpackPlugin = require('modernizr-webpack-plugin'),
    path = require("path"),
    postStylus = require('poststylus'),
    rupture = require('rupture'),
    webpack = require('webpack');

mix.webpackConfig({
    resolve: {
        modules: [
            path.resolve('./resources/assets/js'),
            path.resolve('./node_modules')
        ],
        alias: {
          'masonry': 'masonry-layout',
          'isotope': 'isotope-layout'
        }
    },
    plugins: [
        new webpack.optimize.OccurrenceOrderPlugin(),
        new webpack.ProvidePlugin({
            axios: 'axios',
            vex: 'vex-js',
            vivid: 'vivid'
        }),
        new ModernizrWebpackPlugin({
            'options': [
                'html5shiv',
                'setClasses'
            ],
            'feature-detects': [
                'input',
                'css/objectfit'
            ]
        }),
    ]
});

mix.options({
    postCss: [
        require('cssnano')
    ],
    uglify: {
        compressor: {
            warnings: false
        },
        comments: false
    }
});

mix.stylus('resources/assets/stylus/app.styl', 'public/css/app.css', {
    use: [
        axis(),
        rupture(),
        postStylus(['lost'])
    ]
});

mix.stylus('resources/assets/stylus/admin.styl', 'public/css/admin.css', {
    use: [
        axis(),
        rupture(),
        postStylus(['lost'])
    ]
});

mix.js('resources/assets/js/app.js', 'public/js');
mix.js('resources/assets/js/admin.js', 'public/js');

if (mix.config.inProduction) {
    mix.version();
}

mix.browserSync({
    proxy: 'website.dev',
    notify: false,
    open: false
});

mix.disableNotifications();

Most helpful comment

This has been fixed, and will be included in the next tagged release.

All 4 comments

I was testing which version was the last version that worked for me out of the box, it was version 0.8.1. Not sure if it is related.
I've tested with 0.8.4, 0.8.8 and 0.9.2. Those didn't work out of the box. Not sure of the reason. When I have more time i'll try to give more information.

Same here

Laravel Mix Version: 0.9.2
Node Version 6.9.1:
NPM Version 4.0.5:
OS: Windows 10 Pro

Same here. Was trying out 0.10.0 and got this behavior. Everything returns a 404, including the vendor.js and manifest.js files.

Wasn't sure what version I had before, but I tried 0.8.1 like @Mark-Hoog mentioned and everything works fine again.

My webpack.mix.js:

const mix = require('laravel-mix')
const path = require('path')
const fs = require('fs')

const dependencies = Object.keys(JSON.parse(fs.readFileSync('./package.json')).dependencies)
const production = process.env.NODE_ENV === 'production'

mix
  .webpackConfig({
    module: {
      rules: [
        {       
          test: /\.css$/,       
          loader: 'style-loader!css-loader'     
        }
      ]
    },
    resolve: {
      modules: [
        path.resolve('./resources/assets/js'),      
        path.resolve('./node_modules')
      ]
    }
  })
  .js('resources/assets/js/apps/front/app.js', '/dist/js/front.js')
  .js('resources/assets/js/apps/admin/app.js', '/dist/js/admin.js')
  .autoload({})
  .extract(dependencies)
  .sass('resources/assets/sass/app.scss', '/dist/css/app.css')  
  .sass('resources/assets/sass/hr.scss', '/dist/css/hr.css')
  .sourceMaps()

if (production) {
  mix.version()
}

This has been fixed, and will be included in the next tagged release.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Cheddam picture Cheddam  路  3Comments

terion-name picture terion-name  路  3Comments

mstralka picture mstralka  路  3Comments

mementoneli picture mementoneli  路  3Comments

amin101 picture amin101  路  3Comments