Unexpected replaceable file in production

Apologies, but this error message is useless, and I cannot work out from the source code how to determine the source of the error.

Does anyone happen to know what this is, how to determine the cause, and how to fix it?


Error: Unexpected replaceable file in production
    at packages/webapp/webapp_server.js:934:21
    at packages/webapp-hashing/webapp-hashing.js:31:31
    at Array.forEach (<anonymous>)
    at Function._.each._.forEach (packages/underscore.js:139:11)
    at Object.WebAppHashing.calculateClientHash (packages/webapp-hashing/webapp-hashing.js:30:5)
    at versionReplaceable (packages/webapp/webapp_server.js:930:23)
    at Object.calculateClientHashReplaceable (packages/webapp/webapp_server.js:255:60)
    at packages/autoupdate/autoupdate_server.js:82:16
    at Array.forEach (<anonymous>)
    at updateVersions (packages/autoupdate/autoupdate_server.js:73:15)
    at packages/autoupdate/autoupdate_server.js:134:3
    at Function.time (/bundle/bundle/programs/server/profile.js:273:30)
    at /bundle/bundle/programs/server/boot.js:415:15
    at /bundle/bundle/programs/server/boot.js:465:7
    at Function.run (/bundle/bundle/programs/server/profile.js:280:14)
    at /bundle/bundle/programs/server/boot.js:463:13

If you set the NODE_ENV variable to development or not use the --debug option when having Meteor build the app, it will not throw the error.

I created a PR to fix it: Fix issues with HMR and meteor build --debug by zodern · Pull Request #11922 · meteor/meteor · GitHub