aleph.js icon indicating copy to clipboard operation
aleph.js copied to clipboard

Is it possible to ignore css module expression like `import "//cdn.com/external.css"` for SSR?

Open ahuigo opened this issue 3 years ago • 2 comments
trafficstars

What I mean is that, is it possible to skip this import "cdn/external.css" expression at hydrate server side?

Since this expression can only be used at browser side.

image

ahuigo avatar Sep 09 '22 14:09 ahuigo

try <link /> in <Head />:

import { Head } from "aleph/react";
export default function Index() {
  // ...
  return (
    <div>
      <Head>
        <title>Monaco Editor</title>
        <link
          rel="stylesheet"
          href="https://esm.sh/v78/[email protected]/esnext/monaco-editor.css"
        />
      </Head>
      <div ref={editorRef}>
        <span style={{ color: "darkgray" }}>loading...</span>
      </div>
    </div>
  );
}

ddosakura avatar Sep 16 '22 08:09 ddosakura

@ddosakura It's not a good way for external package. Maybe, we should wait Deno to support it. https://github.com/denoland/deno/issues/11961

ahuigo avatar Sep 16 '22 10:09 ahuigo