dev: add dev2 env

This commit is contained in:
KernelDeimos 2024-10-19 18:22:09 -04:00
parent 0fb4f73d76
commit b5535ae3ca
2 changed files with 8 additions and 2 deletions

View File

@ -64,6 +64,11 @@ window.gui = async function(options){
// await window.loadScript(`${options.asset_dir}/initgui.js`, {isModule: true}); // 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 // PROD: load the minified bundles if we are in production mode
// note: the order of the bundles is important // note: the order of the bundles is important
// note: Build script will prepend `window.gui_env="prod"` to the top of the file // note: Build script will prepend `window.gui_env="prod"` to the top of the file

View File

@ -52,6 +52,7 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
* }); * });
*/ */
async function build(options){ async function build(options){
const PUTER_ENV = process.env.PUTER_ENV || 'prod';
// ----------------------------------------------- // -----------------------------------------------
// Delete ./dist/ directory if it exists and create a new one // Delete ./dist/ directory if it exists and create a new one
// ----------------------------------------------- // -----------------------------------------------
@ -132,7 +133,7 @@ async function build(options){
const webpack_opts = { const webpack_opts = {
...(await BaseConfig({ ...(await BaseConfig({
...options, ...options,
env: 'prod', env: PUTER_ENV,
})), })),
mode: 'production', mode: 'production',
optimization: { optimization: {
@ -158,7 +159,7 @@ async function build(options){
// Prepend `window.gui_env="prod";` to `./dist/gui.js` // Prepend `window.gui_env="prod";` to `./dist/gui.js`
fs.writeFileSync( fs.writeFileSync(
path.join(__dirname, 'dist', 'gui.js'), 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 = [ const copy_these = [