DenoDDeno
Powered by
Donald BidenD
Denoβ€’2y agoβ€’
14 replies
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])
  }
}
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])
  }
}
Deno banner
DenoJoin
Chat about Deno, a modern runtime for JavaScript and TypeScript.
20,944Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

[Fresh 2] How to reference DOM types in Islands?
vicaryVvicary / help
6mo ago
[Fresh 2] How to a add tailwind plugins?
vicaryVvicary / help
6mo ago
window variable in fresh islands
rnbguyRrnbguy / help
4y ago