Merge branch 'tusooa/1362-no-create-app-on-first-visit' into 'develop'

Create an app only when needed

See merge request pleroma/pleroma-fe!2073
This commit is contained in:
HJ 2025-03-10 13:30:37 +00:00
commit 7ba5e6d31c
12 changed files with 449 additions and 34 deletions

28
build/msw_plugin.js Normal file
View file

@ -0,0 +1,28 @@
import { resolve } from 'node:path'
import { readFile } from 'node:fs/promises'
const target = 'node_modules/msw/lib/mockServiceWorker.js'
const mswPlugin = () => {
let projectRoot
return {
name: 'msw-plugin',
apply: 'serve',
configResolved (conf) {
projectRoot = conf.root
},
configureServer (server) {
server.middlewares.use(async (req, res, next) => {
if (req.path === '/mockServiceWorker.js') {
const file = await readFile(resolve(projectRoot, target))
res.set('Content-Type', 'text/javascript')
res.send(file)
} else {
next()
}
})
}
}
}
export default mswPlugin