修改Cesium本来的代码后想进行编译打包,在最后一步npm run build会报如下的错,各位要怎么解决
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:\Program Files\Apache Software Foundation\Tomcat 9.0_Tomcat9.1\webapps\Cesium-1.83\package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
at file:///C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%209.0_Tomcat9.1/webapps/Cesium-1.83/gulpfile.js:1:12
at ModuleJob.run (internal/modules/esm/module_job.js:169:25)
at async Loader.import (internal/modules/esm/loader.js:177:24)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! cesium@1.83.0 build: `gulp build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the cesium@1.83.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\hp\AppData\Roaming\npm-cache\_logs\2021-08-11T03_31_01_883Z-debug.log