Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: custom loader option #14842

Closed
lidessen opened this issue Jun 11, 2022 · 2 comments
Closed

Suggestion: custom loader option #14842

lidessen opened this issue Jun 11, 2022 · 2 comments
Labels
duplicate a duplicate of another issue

Comments

@lidessen
Copy link

lidessen commented Jun 11, 2022

Maybe Deno can make web apps more cloud native via a loader option

deno.json

{
  "loaders": {
    "*.vue": "https://deno.land/x/aleph@1.0.0-alpha.66/loaders/vue.ts",
    "*.vue!react": "https://deno.land/x/vue-loader/vue-react.ts",
    "*.(css|scss)": "./style-loader.ts"
  }
}

style-loader.ts

import { ModuleLoader, someHelperFunciton } from "https://deno.land/std@0.143.0/loader/mod.ts"

export default class StyleLoader implements ModuleLoader {
  // ...
}

declare module "*.css" {
  // ...
}

SomeComponent.tsx

import style from "https://esm.sh/some-lib/SomeComponent.css"

// or even import a vue component to react component via a specific loader
import Button from "https://esm.sh/some-ui-lib/Button.vue!react"
  • What loaders do is transform a non js/ts module to a ts modlue
  • Deno can provide a cache API for loaders
@masx200
Copy link

masx200 commented Jul 16, 2022

https://nodejs.org/dist/latest-v18.x/docs/api/esm.html#loaders

@kitsonk kitsonk added the duplicate a duplicate of another issue label Jul 16, 2022
@kitsonk
Copy link
Contributor

kitsonk commented Jul 16, 2022

Duplicate of #1739

@kitsonk kitsonk marked this as a duplicate of #1739 Jul 16, 2022
@kitsonk kitsonk closed this as not planned Won't fix, can't repro, duplicate, stale Jul 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate a duplicate of another issue
Projects
None yet
Development

No branches or pull requests

3 participants