I got an error when using this line of code
const sass = require('gulp-sass')(require('sass'));
The error output is :
Requiring external module babel-register
ReferenceError: require is not defined in ES module scope, you can use import instead
This file is being treated as an ES module because it has a '.js' file extension and 'C:\xampp-clean\htdocs\myfirsttheme\package.json' contains "type": "module". T
o treat it as a CommonJS script, rename it to use the '.cjs' file extension.
I have changed
const sass = require('gulp-sass')(require('sass'));
the error disappeared but I am getting this error :
Requiring external module babel-register
TypeError: Cannot read property 'prod' of undefined
and this line is causing the error :
const PRODUCTION = yargs.argv.prod;
Do anyone has an idea?
I have tried a lot and googled this error but I did not find a solution , do anyone has an idea about this ? Thanks in advance