Donald BidenD
Deno15mo ago
Donald Biden

How to load islands in Fresh 2.0 plugins?

Im doing this one but looks like it's not working

import * as allIslands from './islands/mod.ts' // named export components

export function somePlugin<T>(
  app: App<T>,
  options: SomeOptions = {}
) {
  app.use(someMiddleware(options))

  const islandsUrl = new URL('./islands/mod.ts', import.meta.url);
  for (const key of Object.keys(allIslands)) {
    app.island(islandsUrl, key, allIslands[key])
  }
}
Was this page helpful?