Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"private": true,
"dependencies": {
"egg-passport": "^2.0.0",
"egg-view-ejs": "^2.0.0",
"egg-view-ejs": "^3.0.0",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

This major version upgrade to egg-view-ejs v3.0.0 introduces breaking changes from its underlying dependency, ejs v3, which will likely cause runtime errors in your application.

The Problem:
In ejs v3, local variables are no longer automatically passed to templates included with <% include %>. Your view app/view/ejs/home.ejs includes body.ejs, which expects the user variable. This variable will now be undefined, causing a rendering failure.

Affected Code:

  • app/view/ejs/home.ejs: <% include body.ejs %>
  • app/view/ejs/body.ejs: <h2>... welcome <%= user.name %></h2>

Required Action:
Before merging, you must update your EJS templates to explicitly pass data to includes. For example:

<%# In home.ejs %>
<%- include('body.ejs', { user: user }) %>

Also note that the include directive is deprecated in ejs v3. The recommended syntax uses the include() function, as shown above.

Please carefully test all EJS views after applying this dependency upgrade to ensure the application functions correctly.

"egg-view-nunjucks": "^2.1.4",
"egg1": "^1.11.0",
"egg2": "^2.37.0",
Expand Down