From 190642224dcb404acf98286efb50ca1eaaafdf19 Mon Sep 17 00:00:00 2001 From: mochaaP Date: Tue, 21 Jun 2022 15:07:22 +0000 Subject: [PATCH] fix: running on gitpod --- .gitpod.yml | 2 ++ resources/assets/src/scripts/init.ts | 6 ++---- webpack.config.ts | 5 ++++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.gitpod.yml b/.gitpod.yml index e0188665..3ee4f675 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -4,6 +4,8 @@ tasks: - init: composer install command: | cp .env.example .env + mkdir public/app/ + cp resources/assets/src/images/bg.webp resources/assets/src/images/favicon.ico public/app touch storage/database.db sed 's/DB_CONNECTION=mysql/DB_CONNECTION=sqlite/' -i .env sed 's/DB_DATABASE=blessingskin/DB_DATABASE=\/workspace\/blessing-skin-server\/storage\/database\.db/' -i .env diff --git a/resources/assets/src/scripts/init.ts b/resources/assets/src/scripts/init.ts index bc86e664..715a7b7d 100644 --- a/resources/assets/src/scripts/init.ts +++ b/resources/assets/src/scripts/init.ts @@ -1,10 +1,8 @@ declare let __webpack_public_path__: string +declare const __blessing_public_path__: string if (process.env.NODE_ENV === 'development') { - const url = new URL(blessing.base_url) - url.port = '8080' - url.pathname = '/app/' - __webpack_public_path__ = url.toString() + __webpack_public_path__ = __blessing_public_path__ } else { const link = document.querySelector('link#cdn-host') const base = link?.href ?? blessing.base_url diff --git a/webpack.config.ts b/webpack.config.ts index 3bceb45e..5227fcd7 100644 --- a/webpack.config.ts +++ b/webpack.config.ts @@ -123,6 +123,7 @@ export default function (env?: Env): webpack.Configuration[] { version: {}, }, 'process.platform': '"browser"', + __blessing_public_path__: JSON.stringify(htmlPublicPath), }), ].concat(isDev ? [new webpack.HotModuleReplacementPlugin()] : []), resolve: { @@ -151,7 +152,9 @@ export default function (env?: Env): webpack.Configuration[] { hot: true, hotOnly: true, stats: 'errors-warnings', - allowedHosts: isGitpod ? ['localhost', '.gitpod.io'] : undefined, + allowedHosts: ['localhost'].concat( + isDev && isGitpod ? ['.gitpod.io'] : [], + ), }, stats: 'errors-warnings', ignoreWarnings: [/size limit/i],