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

While rendering : Build caching incompatibility with file import that gets updated might need some documentation, or a best practice to do it #315

Closed
pierreminiggio opened this issue Apr 26, 2021 · 2 comments
Projects

Comments

@pierreminiggio
Copy link

pierreminiggio commented Apr 26, 2021

Hello !
As you may have seen on my first project using remotion (https://github.com/pierreminiggio/youtube-likes-recap-video-maker),
I decided to get some of my data through reading a JSON file (using an import).

But then when I decided to run my project on my VPS, the first render went perfectly fine.
But when rendering for the 2nd time (after the file likes.json got refreshed), the final video was missing every clip that would be pulled from likes.json, Similar that what I would expect to see if I was reading an empty file.

I'm glad that remotion render cli tells me that it's caching the build, because it helped me figure out that it might be the issue.
And sure enough I disabled caching and it fixed my issue.

Maybe it should be documented NOT to import JSON files that gets updated between 2 renders so people don't do what I did ? And that we should use props instead ?
Or maybe should we have a recommended practice to read local files that gets updated between 2 renders ?

@JonnyBurger
Copy link
Member

This sounds like a Webpack bug to me.
It will bust the cache if you change a .js file in your project, but not if you change a .json file, I assume this is because all files except .json are imported using a "loader" but JSON loading is built in.

I'll try to make a repro case soon and if my suspicion is confirmed, I'll make an issue in the webpack repo.

@JonnyBurger
Copy link
Member

The problem does not seem to be there anymore in the current version:

{
	"Text": "Hello World"
}
import {AbsoluteFill} from 'remotion';
import entry from './entry.json';

export const MyComposition = () => {
	return (
		<AbsoluteFill
			style={{
				justifyContent: 'center',
				alignItems: 'center',
				fontSize: 200,
				color: 'blue',
			}}
		>
			{entry.Text}
		</AbsoluteFill>
	);
};

With the default settings, I can change the text every time and it gets fully updated.
Therefore I feel confident closing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Roadmap
Planned
Development

No branches or pull requests

2 participants