-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Closed
Labels
Description
- I have searched the issues of this repository and believe that this is not a duplicate.
Version
2.2.8
Environment
Environment Info:
System:
OS: macOS 11.6.1
CPU: (6) x64 Intel(R) Core(TM) i5-8500B CPU @ 3.00GHz
Binaries:
Node: 12.22.7 - /usr/local/bin/node
Yarn: 1.22.10 - /usr/local/bin/yarn
npm: 6.14.15 - /usr/local/bin/npm
Browsers:
Chrome: 96.0.4664.55
Edge: Not Found
Firefox: Not Found
Safari: 15.1
npmGlobalPackages:
@vue/cli: Not Found
Reproduction link
https://github.com/realkimmy/vue3-ssr-issue
Steps to reproduce
- yarn install
- yarn build
- yarn server 报错
去掉组件库后正常运行
What is expected?
正常运行
What is actually happening?
internal/modules/cjs/loader.js:1015
throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath);
^
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /Users/ying/workspace/FEProjects/vue3-ssr-issue/node_modules/@babel/runtime/helpers/esm/objectSpread2.js
require() of ES modules is not supported.
require() of /Users/ying/workspace/FEProjects/vue3-ssr-issue/node_modules/@babel/runtime/helpers/esm/objectSpread2.js from /Users/ying/workspace/FEProjects/vue3-ssr-issue/dist/node/js/home.8394c21e.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename objectSpread2.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /Users/ying/workspace/FEProjects/vue3-ssr-issue/node_modules/@babel/runtime/helpers/esm/package.json.
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1015:13)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.193e (/Users/ying/workspace/FEProjects/vue3-ssr-issue/dist/node/js/home.8394c21e.js:520:18)
at __webpack_require__ (/Users/ying/workspace/FEProjects/vue3-ssr-issue/dist/node/js/home.8394c21e.js:21:30)
at Module.f23d (/Users/ying/workspace/FEProjects/vue3-ssr-issue/dist/node/js/home.8394c21e.js:5109:22)
at __webpack_require__ (/Users/ying/workspace/FEProjects/vue3-ssr-issue/dist/node/js/home.8394c21e.js:21:30)
at Object.0747 (/Users/ying/workspace/FEProjects/vue3-ssr-issue/dist/node/js/home.8394c21e.js:255:48) {
code: 'ERR_REQUIRE_ESM'
}
[nodemon] app crashed - waiting for file changes before starting...