-
-
Notifications
You must be signed in to change notification settings - Fork 498
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Writing to frozen/reserved data fails silently (should error in strict mode/ESM) #3470
Comments
This is almost certainly due to reserved data (via your https://www.11ty.dev/docs/data-eleventy-supplied/#frozen-data |
You're quite right indeed. I did figure it had to do with frozen objects but I didn't realize I was looking for this entry in the release notes:
I guess a better error message would be nice but perhaps the coincidence of someone using a file named However, one question: shouldn't this error trigger also on build or first serve? |
Yeah, for sure. Eleventy does let you merge properties into the |
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze#description notes that not all assignment to frozen objects results in errors 🫠 |
For posterity and search engine users, here's how I solved this issue in my site: kleinfreund/kleinfreund.de@c9032dc TL;DR: change the file name of @zachleat I'm happy to close to this as ultimately a user error but of course feel free to leave this open if you do want to/are able to improve the error message in some way. |
There is some inconsistency happening here, per JavaScript rules writing to a frozen property will error in strict mode (ESM) but currently it’s failing silently (non-strict mode behavior). So, not great but not harmful. I’ll leave this one open in |
Operating system
Windows 11, macOS
Eleventy
3.0.0
Describe the bug
Since upgrading to Eleventy 3.0.0,
eleventy --serve
is crashing after picking up the first changes to the watched files (i.e. not immediately upon runningeleventy --serve
).Error:
Turning on debug mode for
Eleventy*
, the source of the issue points to global data files:Deleting
src/_data/eleventy.js
resolves the issue.The contents of that file are:
The contents don't seem to matter (e.g. removing the access to
process
doesn't resolve the issue).Reproduction steps
Set up the reproduction project.
Run
npm start
and make a file change in a watched file (e.g.src/_includes/layouts/base.liquid
).Observe the watcher output for result 1. Stop the
npm start
script.For working behavior comparison: Delete
src/_data/eleventy.js
.Repeat step 2 and observe the watcher output for result 2. Stop the
npm start
script.For working behavior comparison: Run:
git reset --hard https://github.com/kleinfreund/kleinfreund.de/commit/a6b5e66f03f651050701e4935d53cc291ad56a3b # The commit right before I upgraded to Eleventy 3.0.0 npm install
Repeat step 2 and observe the watcher output for result 3. Stop the
npm start
script.Delete the reproduction project.
cd .. rm -rf kleinfreund.de
Expected behavior
Result 1, 2, and 3 show no errors after the file change.
The actual behavior, however, shows an error in result 1. Result 2 and 3 show the working behavior.
Reproduction URL
https://github.com/kleinfreund/kleinfreund.de
Screenshots
No response
The text was updated successfully, but these errors were encountered: