perf: 支持gitpod

This commit is contained in:
阿胖 2023-02-21 06:37:37 +00:00
parent d9c036e359
commit 6e51b7f300
4 changed files with 42 additions and 10 deletions

13
.gitpod.yml Normal file
View File

@ -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

View File

@ -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:

View File

@ -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",

35
webpack.mix.js vendored
View File

@ -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({