let argv = require('yargs').argv;
let path = require('path');

class Paths {
    /**
     * Create a new Paths instance.
     */
    constructor() {
        if (argv['$0'].includes('ava')) {
            this.rootPath = path.resolve(__dirname, '../');
        } else {
            this.rootPath = process.cwd();
        }
    }

    /**
     * Set the root path to resolve webpack.mix.js.
     *
     * @param {string} path
     */
    setRootPath(path) {
        this.rootPath = path;

        return this;
    }

    /**
     * Determine the path to the user's webpack.mix.js file.
     */
    mix() {
        return this.root(
            process.env && process.env.MIX_FILE
                ? process.env.MIX_FILE
                : 'webpack.mix'
        );
    }

    /**
     * Determine the project root.
     *
     * @param {string|null} append
     */
    root(append = '') {
        return path.resolve(this.rootPath, append);
    }
}

module.exports = Paths;

@@ -600,30 +600,36 @@
 ) %7B%0A        
-return
+const path =
  this.root(%0A
@@ -675,32 +675,16 @@
 MIX_FILE
-%0A               
  ? proce
@@ -698,16 +698,32 @@
 MIX_FILE
+ : 'webpack.mix'
 %0A       
@@ -723,24 +723,28 @@
         
+);%0A%0A
         
 : 'webpa
@@ -739,33 +739,162 @@
     
-: 'webpack.mix'%0A        )
+try %7B%0A            require.resolve(%60$%7Bpath%7D.cjs%60);%0A%0A            return %60$%7Bpath%7D.cjs%60;%0A        %7D catch (err) %7B%0A            //%0A        %7D%0A%0A        return path
 ;%0A  

Support .cjs fallback for mix config file (#2701)