Skip to content

Commit

Permalink
fix(demo): public folder base path v3
Browse files Browse the repository at this point in the history
  • Loading branch information
yume-chan committed Feb 9, 2022
1 parent fce1dd7 commit daf726f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions apps/demo/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ module.exports = withMDX({
experimental: {
esmExternals: 'loose',
},
publicRuntimeConfig: {
basePath: process.env.BASE_PATH || '',
},
webpack(config, options) {
config.module.rules.push({
resourceQuery: /url/,
Expand Down
4 changes: 3 additions & 1 deletion apps/demo/pages/file-manager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { AdbSyncEntryResponse, AdbSyncMaxPacketSize, LinuxFileType } from '@yume
import { action, autorun, makeAutoObservable, observable, runInAction } from "mobx";
import { observer } from "mobx-react-lite";
import { NextPage } from "next";
import getConfig from "next/config";
import Head from "next/head";
import Router, { useRouter } from "next/router";
import path from 'path';
Expand All @@ -17,8 +18,9 @@ import { asyncEffect, chunkFile, formatSize, formatSpeed, Icons, pickFile, Route

let StreamSaver: typeof import('streamsaver');
if (typeof window !== 'undefined') {
const { publicRuntimeConfig } = getConfig();
StreamSaver = require('streamsaver');
StreamSaver.mitm = (process.env.BASE_PATH || '') + '/StreamSaver/mitm.html';
StreamSaver.mitm = publicRuntimeConfig.basePath + '/StreamSaver/mitm.html';
}

interface ListItem extends AdbSyncEntryResponse {
Expand Down

1 comment on commit daf726f

@vercel
Copy link

@vercel vercel bot commented on daf726f Feb 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.