From 49defa6c2b79f4a89713ce48684c00cc7ad40c33 Mon Sep 17 00:00:00 2001 From: Juanfran Date: Tue, 19 Mar 2024 13:04:47 +0100 Subject: [PATCH] fix: prevent server crash in the dev server --- README.md | 6 +++--- apps/contrast-plugin/vite.config.ts | 2 +- apps/example-plugin/vite.config.ts | 2 +- docs/create-plugin.md | 2 +- libs/plugins-runtime/vite.config.ts | 4 +++- package.json | 4 ++-- 6 files changed, 11 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index fd002b6..4f67d02 100644 --- a/README.md +++ b/README.md @@ -46,18 +46,18 @@ At this point, you have 2 choices: ``` // for the example plugin -npm run start +npm run start:example or -npx nx run example-plugin:serve-static --port 4201 +npx nx run example-plugin:build --watch & npx nx run example-plugin:preview ``` or ``` // for the contrast plugin -npx nx run contrast-plugin:serve-static --port 4210 +npx nx run contrast-plugin:build --watch & npx nx run contrast-plugin:preview ``` Open in your browser: `http://localhost:4210/` diff --git a/apps/contrast-plugin/vite.config.ts b/apps/contrast-plugin/vite.config.ts index 4cc4784..d4941c1 100644 --- a/apps/contrast-plugin/vite.config.ts +++ b/apps/contrast-plugin/vite.config.ts @@ -13,7 +13,7 @@ export default defineConfig({ }, preview: { - port: 4300, + port: 4210, host: 'localhost', }, diff --git a/apps/example-plugin/vite.config.ts b/apps/example-plugin/vite.config.ts index 1fa140e..04db40b 100644 --- a/apps/example-plugin/vite.config.ts +++ b/apps/example-plugin/vite.config.ts @@ -13,7 +13,7 @@ export default defineConfig({ }, preview: { - port: 4300, + port: 4201, host: 'localhost', }, diff --git a/docs/create-plugin.md b/docs/create-plugin.md index c767ad2..ccbf5a3 100644 --- a/docs/create-plugin.md +++ b/docs/create-plugin.md @@ -41,7 +41,7 @@ Add to `tsconfig.app.json` Then, run the static server ``` -npx nx run example-plugin:serve-static --port 4201 +npx nx run example-plugin:build --watch & npx nx run example-plugin:preview ``` Finally, go to penpot and load the plugin. Run the command in the console devtools from your browser. diff --git a/libs/plugins-runtime/vite.config.ts b/libs/plugins-runtime/vite.config.ts index a0008b7..49e7cc3 100644 --- a/libs/plugins-runtime/vite.config.ts +++ b/libs/plugins-runtime/vite.config.ts @@ -45,7 +45,9 @@ export default defineConfig({ }, sourcemap: true, }, - + preview: { + port: 4200, + }, test: { globals: true, cache: { diff --git a/package.json b/package.json index 6b12707..a9c3fd6 100644 --- a/package.json +++ b/package.json @@ -3,8 +3,8 @@ "version": "0.0.0", "license": "MIT", "scripts": { - "start": "npx nx run plugins-runtime:serve-static --port 4200", - "start:example": "npx nx run example-plugin:serve-static --port 4201", + "start": "npx nx run plugins-runtime:build --watch & npx nx run plugins-runtime:preview", + "start:example": "npx nx run example-plugin:build --watch & npx nx run example-plugin:preview", "start:rpc-api": "npx nx serve rpc-api", "start:styles-example": "npx nx run example-styles:serve --port 4202", "build": "npx nx build plugins-runtime --emptyOutDir=true",