webcontainer-utils
is a small utility package for WebContainers. Currently there are only a small number of utils. More will be added in the future. If you have any suggestions feel free to open an issue or a PR!
Converts a Vite raw glob import into Webcontainers FileSystemTree structure.
import { WebContainer } from '@webcontainer/api'
import { convertRawGlobImportToFileSystemTree } from 'webcontainer-utils'
const files = import.meta.glob('./playground/**/*.*', { as: 'raw' })
const filesystem = await convertRawGlobImportToFileSystemTree(files)
const container = await WebContainer.boot()
container.mount(filesystem)
MIT License © 2023 Jacob Clevenger