Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove xstate devtools in prod #291

Merged
merged 1 commit into from
Jun 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/solid-crs-manage/lib/app-root.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export class AppRootComponent extends RxLitElement {
}
)).withContext({
alerts: [],
}), { devTools: true },
}), { devTools: process.env.MODE === 'DEV' },
);

/**
Expand Down
10 changes: 7 additions & 3 deletions packages/solid-crs-manage/lib/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@ import './index';
*
* https://github.com/davidkpiano/xstate/tree/master/packages/xstate-inspect
*/
inspect({
iframe: false, // open in new window
});
if (process.env.MODE === 'DEV') {

inspect({
iframe: false, // open in new window
});

}
lem-onade marked this conversation as resolved.
Show resolved Hide resolved

/**
* Register tags for components.
Expand Down
3 changes: 0 additions & 3 deletions packages/solid-crs-manage/lib/env.d.ts

This file was deleted.

7 changes: 6 additions & 1 deletion packages/solid-crs-manage/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import { defineConfig, loadEnv } from 'vite';

export default defineConfig( ({ command, mode }) => {
const env = loadEnv(mode, process.cwd())
const env = loadEnv(mode, process.cwd());

// expose .env as process.env instead of import.meta since jest does not import meta yet
const envWithProcessPrefix = Object.entries(env).reduce(
(prev, [key, val]) => {
return {
...prev,
['process.env.' + key]: `"${val}"`,
['process.env.DEV']: `"${command === 'serve'}"`,
['process.env.PROD']: `"${command === 'build'}"`,
['process.env.MODE']: command === 'build' ? `"PROD"` : `"DEV"`,
}
},
{},
Expand All @@ -20,6 +23,7 @@ export default defineConfig( ({ command, mode }) => {
server: {
port: 3002,
},
mode: 'development',
define: envWithProcessPrefix,
}
} else if (command === 'build'){
Expand All @@ -32,6 +36,7 @@ export default defineConfig( ({ command, mode }) => {
server: {
port: 3002,
},
mode: 'production',
define: envWithProcessPrefix,
}
}
Expand Down