【发布时间】:2021-11-05 00:46:39
【问题描述】:
使用这行代码时出现错误
const sass = require('gulp-sass')(require('sass'));
错误输出是:
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.
我变了
const sass = require('gulp-sass')(require('sass'));
错误消失了,但我收到了这个错误:
Requiring external module babel-register
TypeError: Cannot read property 'prod' of undefined
这行导致错误:
const PRODUCTION = yargs.argv.prod;
有人有想法吗?
我已经尝试了很多并在谷歌上搜索了这个错误,但我没有找到解决方案,有人对此有任何想法吗? 提前致谢
【问题讨论】:
标签: javascript sass gulp gulp-sass