ReferenceError: _dirname is not defined

//webpack打包:获取绝对路径时报错

const resolve = dir => path.resolve(_dirname,dir);

解决方法:webpack.config.js配置文件中----" dirname " 必须为两个下划线“_ _”,否则打包报错

例如:

ReferenceError: _dirname is not defined_第1张图片

 

你可能感兴趣的:(webpack)