Skip to content
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

Global data object not updating if using a JavaScript Data File #341

Closed
navarrorc opened this issue Dec 13, 2018 · 6 comments
Closed

Global data object not updating if using a JavaScript Data File #341

navarrorc opened this issue Dec 13, 2018 · 6 comments
Labels
bug: windows Issue reported for the Windows environment bug duplicate
Milestone

Comments

@navarrorc
Copy link

navarrorc commented Dec 13, 2018

Using Windows 10 with nodejs v11.4.0.

I'm experiencing and odd behavior where the global object that represents the JavaScript data file is not updating when I make changes to the source javascript file. I'm running eleventy --serve and I have also tried eleventy --watch.

There's no issue if I use .json files, the global object updates as expected. The problem is only happening when using .js files that use module.exports

Here is an example of a .js file that does not update when I add more values to the array.

users.js
module.exports = ["user1", "user2"];

Please advise. Thank you.

@jevets
Copy link

jevets commented Dec 13, 2018

Tried it as a function?

// users.js
module.exports = () => ([
  "user1",
  "user2",
])

@zachleat zachleat added the open-question Requires additional information before we can proceed. label Dec 13, 2018
@zachleat
Copy link
Member

Hm! We do some require cache busting to make sure that stuff updates properly. I made a reduced test case that seems to work fine with 0.6.0:

eleventy-341-zip.zip

@navarrorc
Copy link
Author

@zachleat I used npx eleventy --serve on your example project and it did not update the global object. I'm running Windows 10 and using nodejs v11.4.0.

@zachleat
Copy link
Member

A ha, Windows—thanks! Maybe related to #340 then!

@zachleat zachleat added bug bug: windows Issue reported for the Windows environment and removed open-question Requires additional information before we can proceed. labels Dec 14, 2018
@navarrorc
Copy link
Author

Maybe one day I can contribute and help fix Windows related bugs. 😢
This is a great open-source project to work on as I find myself using it more and more.

@zachleat
Copy link
Member

This is almost certainly a duplicate of #596 (although that was opened later—the work happened there)

@zachleat zachleat added this to the Next Minor Version milestone Oct 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug: windows Issue reported for the Windows environment bug duplicate
Projects
None yet
Development

No branches or pull requests

3 participants