From 6e51b7f30012d889265f611e3ebb89821a25b942 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=BF=E8=83=96?= Date: Tue, 21 Feb 2023 06:37:37 +0000 Subject: [PATCH] =?UTF-8?q?perf:=20=E6=94=AF=E6=8C=81gitpod?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitpod.yml | 13 +++++++++++++ docker-compose.yml | 2 +- package.json | 2 +- webpack.mix.js | 35 +++++++++++++++++++++++++++-------- 4 files changed, 42 insertions(+), 10 deletions(-) create mode 100644 .gitpod.yml diff --git a/.gitpod.yml b/.gitpod.yml new file mode 100644 index 000000000..f2ba8ab41 --- /dev/null +++ b/.gitpod.yml @@ -0,0 +1,13 @@ +# This configuration file was automatically generated by Gitpod. +# Please adjust to your needs (see https://www.gitpod.io/docs/config-gitpod-file) +# and commit this file to your remote git repository to share the goodness with others. + +tasks: + - init: sudo ./cmd install + command: ./cmd dev + +ports: + - port: 2222 + visibility: public + - port: 22222 + visibility: public diff --git a/docker-compose.yml b/docker-compose.yml index 4d2f58adb..4d6128e5d 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -136,7 +136,7 @@ services: drawio-export: container_name: "dootask-drawio-export-${APP_ID}" - image: "jgraph/export-server" + image: "kuaifan/export-server:latest" platform: linux/amd64 networks: extnetwork: diff --git a/package.json b/package.json index 8939fdc5c..889847e0c 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "internal-ip": "^6.2.0", "jquery": "^3.6.1", "jspdf": "^2.5.1", - "laravel-mix": "^6.0.49", + "laravel-mix": "git+https://github.com/kuaifan/laravel-mix.git#master", "le5le-store": "^1.0.7", "less": "^4.1.2", "less-loader": "^10.2.0", diff --git a/webpack.mix.js b/webpack.mix.js index 123b8d9b5..dfca5bbdc 100644 --- a/webpack.mix.js +++ b/webpack.mix.js @@ -1,8 +1,9 @@ const mix = require('laravel-mix'); const ipv4 = require('internal-ip').v4.sync(); +const execSync = require('child_process').execSync; const argv = process.argv; -let mixBuildName = function (str) { +const mixBuildName = function (str) { if (typeof str !== "string") { return str; } @@ -12,9 +13,20 @@ let mixBuildName = function (str) { return str.replace(/_/g, '/'); } -let isHot = argv.includes('--hot'); -let isElectron = argv.includes('--electron'); -let publicPath = (!isHot && isElectron) ? 'electron/public' : 'public'; +const hmrPublicURL = function (port) { + try { + return execSync('gp url ' + port).toString().trim() + } catch (e) { + return null + } +} + +const devPort = 22222 +const publicURL = hmrPublicURL(devPort) + +const isHot = argv.includes('--hot'); +const isElectron = argv.includes('--electron'); +const publicPath = (!isHot && isElectron) ? 'electron/public' : 'public'; mix .copy('resources/assets/statics/public', publicPath) @@ -27,10 +39,16 @@ mix chunkFilename: ({chunk}) => { return `js/build/${mixBuildName(chunk.id)}.js` } - } + }, }; - if (isElectron && !isHot) { - config.output.publicPath = './' + if (isHot) { + if (publicURL) { + config.output.publicPath = publicURL + '/' + } + } else { + if (isElectron) { + config.output.publicPath = './' + } } return config }) @@ -38,7 +56,8 @@ mix processCssUrls: false, hmrOptions: { host: ipv4 || 'localhost', - port: '22222' + port: devPort, + publicURL }, }) .vue({