Skip to content

Commit

Permalink
Convert env calls
Browse files Browse the repository at this point in the history
  • Loading branch information
twk3 committed Dec 15, 2023
1 parent 38dd354 commit 9417142
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions packages/desktop-client/src/browser-preload.browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const backendWorkerUrl = new URL('./browser-server.js', import.meta.url);
// browser environment this is where we initialize the backend and
// everything else.

const IS_DEV = process.env.NODE_ENV === 'development';
const IS_DEV = import.meta.env.MODE === 'development';
const ACTUAL_VERSION = Platform.isPlaywright ? '99.9.9' : packageJson.version;

// *** Start the backend ***
Expand All @@ -29,8 +29,8 @@ function createBackendWorker() {
type: 'init',
version: ACTUAL_VERSION,
isDev: IS_DEV,
publicUrl: process.env.PUBLIC_URL,
hash: process.env.REACT_APP_BACKEND_WORKER_HASH,
publicUrl: import.meta.env.BASE_URL.slice(0, -1),
hash: import.meta.env.REACT_APP_BACKEND_WORKER_HASH,
isSharedArrayBufferOverrideEnabled: localStorage.getItem(
'SharedArrayBufferOverride',
),
Expand Down
12 changes: 6 additions & 6 deletions packages/desktop-client/vite.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@ const addWatchers = (): Plugin => ({
});

// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
export default defineConfig(async ({ mode }) => {
const env = loadEnv(mode, process.cwd(), '');
const devHeaders = {
'Cross-Origin-Opener-Policy': 'same-origin',
'Cross-Origin-Embedder-Policy': 'require-corp',
};

const buildShims = await path.resolve('./src/build-shims.js');

// Forward Netlify env variables
if (process.env.REVIEW_ID) {
process.env.REACT_APP_REVIEW_ID = process.env.REVIEW_ID;
Expand Down Expand Up @@ -117,17 +119,15 @@ export default defineConfig(({ mode }) => {
disableGlobbing: false,
},
},
optimizeDeps: {
include: ['process'],
},
resolve: {
extensions: resolveExtensions,
},
plugins: [
{
...inject({
global: [path.resolve('src/build-shims.js'), 'global'],
process: [path.resolve('src/build-shims.js'), 'process'],
exclude: ['src/setupTests.jsx'],
global: [buildShims, 'global'],
process: [buildShims, 'process'],
}),
enforce: 'post',
},
Expand Down

0 comments on commit 9417142

Please sign in to comment.