diff --git a/src/gui/src/index.js b/src/gui/src/index.js index 59e20b15..0ea9b609 100644 --- a/src/gui/src/index.js +++ b/src/gui/src/index.js @@ -64,6 +64,11 @@ window.gui = async function(options){ // await window.loadScript(`${options.asset_dir}/initgui.js`, {isModule: true}); } + if (window.gui_env === 'dev2') { + await window.loadScript('/puter.js/v2'); + await window.loadCSS('/dist/bundle.min.css'); + } + // PROD: load the minified bundles if we are in production mode // note: the order of the bundles is important // note: Build script will prepend `window.gui_env="prod"` to the top of the file diff --git a/src/gui/utils.js b/src/gui/utils.js index 37f57c67..748fb836 100644 --- a/src/gui/utils.js +++ b/src/gui/utils.js @@ -52,6 +52,7 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url)); * }); */ async function build(options){ + const PUTER_ENV = process.env.PUTER_ENV || 'prod'; // ----------------------------------------------- // Delete ./dist/ directory if it exists and create a new one // ----------------------------------------------- @@ -132,7 +133,7 @@ async function build(options){ const webpack_opts = { ...(await BaseConfig({ ...options, - env: 'prod', + env: PUTER_ENV, })), mode: 'production', optimization: { @@ -158,7 +159,7 @@ async function build(options){ // Prepend `window.gui_env="prod";` to `./dist/gui.js` fs.writeFileSync( path.join(__dirname, 'dist', 'gui.js'), - `window.gui_env="prod"; \n\n` + fs.readFileSync(path.join(__dirname, 'src', 'index.js')) + `window.gui_env="${PUTER_ENV}"; \n\n` + fs.readFileSync(path.join(__dirname, 'src', 'index.js')) ); const copy_these = [