请问这配置的问题如何解决???
使用vue-cli-service serve
启动项目的时候,报错了:
ERROR Error loading vue.config.js:
ERROR Error [ERR_REQUIRE_ESM]: require() of ES Module D:\pre-study-cesium\vue.config.js from D:\pre-study-cesium\node_modules\@vue\cli-service\lib\Service.js not supported.
vue.config.js is treated as an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which declares all .js files in that package scope as ES modules.
Instead rename vue.config.js to end in .cjs, change the requiring code to use dynamic import() which is available in all CommonJS modules, or change "type": "module" to "type": "commonjs" in D:\pre-study-cesium\package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead).
估计原因是出在package.json
中加了一个"type":"module"
可是,如果不加入这个设置,ifcWatch
和ifcBuild
这两个命令又执行不了。
以下是附上rollup.config.js
里面的配置(这是根据IFC.js的文档去配置的):
rollup.config.mjs
和vue.config.mjs
rollup.config.mjs
的配置如下:package.json
的配置如下:不用加什么"type":"module"了。