Allow disabling tw-load-script-as-plain-text to fix nonsensical errors in TW Desktop

This commit is contained in:
Thomas Weber committed 2021-08-29 17:40:36 -05:00
1 parent e8614de5f8
commit 9961e35705
1 file changed
+4
@@ -3,6 +3,10 @@
const SingleEntryPlugin = require('webpack/lib/SingleEntryPlugin');
module.exports.pitch = function (request) {
// Temporary hack to allow TW Desktop to avoid nonsensical errors
if (process.env.TW_DISABLE_PLAIN_TEXT_LOADER) {
return 'throw new Error("Loader was disabled at build time");';
}
// Technically this loader does work in other environments, but our use case does not want that.
if (this.target !== 'web') {
return 'throw new Error("Not supported in non-web environment");';