Skip to content

Server-side rendering error #3983

Closed
Closed
@langhuihui

Description

@langhuihui
  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

2.1.1

Environment

vue 3.0.11

Reproduction link

https://github.com/langhuihui/test-ssr

Steps to reproduce

yarn
yarn build
yarn ssr

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: /……/node_modules/lodash-es/isPlainObject.js
require() of ES modules is not supported.
require() of /……/node_modules/lodash-es/isPlainObject.js from /……/node_modules/ant-design-vue/lib/_util/props-util/index.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 isPlainObject.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /……/node_modules/lodash-es/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. (/……/node_modules/ant-design-vue/lib/_util/props-util/index.js:27:45)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14) {
code: 'ERR_REQUIRE_ESM'
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions