Ok so this issue is a nasty one, and has only come up occasionally and on certain machines. But sometimes the source loader will throw some error about an unterminated string, and not copy a static file to the output folder. My theory of why this is the case is that JSON.stringify is choking on large and/or unusual binary file contents here in source-loader.
This line that stringifies and exports is intended for text files, and doesn't really do anything for a binary file, except for return a massive string of unusable gibberish. So I'd propose that we do our best to detect some common types of binary files, and if we are able to, handle them in a different way. (Another option as suggested by @kylemac)
Here's what I'm thinking as far as alternate handling for binary files:
Export the raw data as a Blob so that it could actually potentially be used in client-side js.
Ok so this issue is a nasty one, and has only come up occasionally and on certain machines. But sometimes the source loader will throw some error about an unterminated string, and not copy a static file to the output folder. My theory of why this is the case is that
JSON.stringify
is choking on large and/or unusual binary file contents here in source-loader.This line that stringifies and exports is intended for text files, and doesn't really do anything for a binary file, except for return a massive string of unusable gibberish. So I'd propose that we do our best to detect some common types of binary files, and if we are able to, handle them in a different way. (Another option as suggested by @kylemac)
Here's what I'm thinking as far as alternate handling for binary files:
Any thoughts?