Skip to content

Commit

Permalink
cf-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
webees committed Sep 16, 2023
1 parent 83b1170 commit cb776f4
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 6 deletions.
1 change: 0 additions & 1 deletion .env

This file was deleted.

2 changes: 2 additions & 0 deletions .env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
BASE_URL='/'
VUE_APP_PUBLIC_PATH='/'
2 changes: 2 additions & 0 deletions .env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
BASE_URL='/'
VUE_APP_PUBLIC_PATH='//fastly.jsdelivr.net/gh/webees/tfjs-yolov8@cf-pages/'
2 changes: 1 addition & 1 deletion .github/workflows/pages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ jobs:
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
BRANCH: gh-pages
BRANCH: cf-pages
FOLDER: dist
2 changes: 1 addition & 1 deletion src/registerServiceWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { register } from 'register-service-worker'

if (process.env.NODE_ENV === 'production') {
register(`${process.env.BASE_URL}service-worker.js`, {
register(`/service-worker.js`, {
ready() {
console.log('App is being served from cache by a service worker.\n' + 'For more details, visit https://goo.gl/AFskqB')
},
Expand Down
2 changes: 1 addition & 1 deletion src/utils/tf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { yolo } from '@/vue-pinia'

export function loadModel() {
tf.ready().then(async () => {
const model = await tf.loadGraphModel(`/${yolo().name}_web_model/model.json`, {
const model = await tf.loadGraphModel(`${process.env.VUE_APP_PUBLIC_PATH}${yolo().name}_web_model/model.json`, {
onProgress: progress => {
console.log('tf.loadGraphModel', progress)
yolo().loading = progress
Expand Down
2 changes: 1 addition & 1 deletion src/vue-router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const routes: Array<RouteRecordRaw> = [
]

const router = createRouter({
history: createWebHistory(process.env.BASE_URL),
history: createWebHistory('/'),
routes,
linkActiveClass: 'active',
scrollBehavior(to, from, savedPosition) {
Expand Down
7 changes: 6 additions & 1 deletion vue.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const vueServe = c => {
}

const vueConfig = {
publicPath: IS_DEV ? '/' : '//fastly.jsdelivr.net/gh/webees/tfjs-yolov8@gh-pages/',
publicPath: process.env.VUE_APP_PUBLIC_PATH,
outputDir: 'dist',
productionSourceMap: IS_DEV,
integrity: false,
Expand All @@ -50,6 +50,11 @@ const vueConfig = {
open: false,
proxy: null
},
pwa: {
manifestOptions: {
start_url: '/'
}
},
configureWebpack: {
externals: {
'vue-router': 'VueRouter',
Expand Down

0 comments on commit cb776f4

Please sign in to comment.