Laravel-mix: browserSync options

Created on 23 Jul 2017  路  2Comments  路  Source: JeffreyWay/laravel-mix

  • Laravel Mix Version: 1.3.0
  • Node Version : 8.0.0
  • NPM Version : 5.3.0
  • OS: Mac OS X

Description:

I am trying to setup a standalone dev environment without using laravel. I get error when i run this command : npm run watch
The line causes the problem is server: {baseDir: 'dev'}
Notification window says Build Successful but terminal throws error.

This is working _webpack.mix.js_

mix.js('src/js/main.js', 'dev/js')
    .stylus('src/stylus/main.styl', 'dev/css')
    .browserSync({
        port:'3000'
    });

This is not working _webpack.mix.js_

mix.js('src/js/main.js', 'dev/js')
    .stylus('src/stylus/main.styl', 'dev/css')
    .browserSync({
        port:'3000',
        server: {baseDir: 'dev'} // this is the only difference
    });

This is error log from npm

Invalid config. You cannot specify both server & proxy options.    **I don't do that**
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] watch: `NODE_ENV=development webpack --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] watch script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Most helpful comment

You cannot specify both server & proxy options
Pass in the property proxy a value false

.browserSync({
        proxy: false,
        port:'3000',
        server: {baseDir: 'dev'} // this is the only difference
    });

All 2 comments

You cannot specify both server & proxy options
Pass in the property proxy a value false

.browserSync({
        proxy: false,
        port:'3000',
        server: {baseDir: 'dev'} // this is the only difference
    });

@webmarkelov I don't specify both server & proxy. I understand it is not me passing the proxy. The mix defaults. Thank you for pointing out.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wendt88 picture wendt88  路  3Comments

Micaso picture Micaso  路  3Comments

dtheb picture dtheb  路  3Comments

amin101 picture amin101  路  3Comments

nezaboravi picture nezaboravi  路  3Comments