semi-design icon indicating copy to clipboard operation
semi-design copied to clipboard

[BUG] cloudflare remix框架模板下报错

Open favoritewky opened this issue 6 months ago • 0 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Which Component

所有

Semi Version

2.64.0

Current Behavior

cloudflare remix框架模板下报错

Unexpected token ':'
    at wrapSafe (node:internal/modules/cjs/loader:1281:20)
    at Module._compile (node:internal/modules/cjs/loader:1321:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
    at Module.load (node:internal/modules/cjs/loader:1208:32)
    at Module._load (node:internal/modules/cjs/loader:1024:12)
    at Module.require (node:internal/modules/cjs/loader:1233:19)
    at require (node:internal/modules/helpers:179:18)
    at Object.<anonymous> (Y:\ffb\software\ffbmaster-web\node_modules\@douyinfe\semi-ui\lib\cjs\index.js:618:1)
    at Module._compile (node:internal/modules/cjs/loader:1358:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
    at Module.load (node:internal/modules/cjs/loader:1208:32)
    at Module._load (node:internal/modules/cjs/loader:1024:12)
    at cjsLoader (node:internal/modules/esm/translators:348:17)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:297:7)
    at ModuleJob.run (node:internal/modules/esm/module_job:222:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
    at async nodeImport (file:///Y:/ffb/software/ffbmaster-web/node_modules/vite/dist/node/chunks/dep-BzOvws4Y.js:52954:15)
    at async ssrImport (file:///Y:/ffb/software/ffbmaster-web/node_modules/vite/dist/node/chunks/dep-BzOvws4Y.js:52812:16)
    at async eval (Y:/ffb/software/ffbmaster-web/app/routes/_index.tsx:4:31)
    at async instantiateModule (file:///Y:/ffb/software/ffbmaster-web/node_modules/vite/dist/node/chunks/dep-BzOvws4Y.js:52870:5

Expected Behavior

No response

Steps To Reproduce

yarn create cloudflare

frameworkstart remix

直接加载组件就报错了。 官方文档说了 https://remix.run/docs/en/main/start/future-flags#vite-plugin 要去除 Remove @remix-run/css-bundle

Vite has built-in support for CSS side effect imports, PostCSS and CSS Modules, among other CSS bundling features. The Remix Vite plugin automatically attaches bundled CSS to the relevant routes.

The @remix-run/css-bundle package is redundant when using Vite since its cssBundleHref export will always be undefined.

👉 Uninstall @remix-run/css-bundle

npm uninstall @remix-run/css-bundle

👉 Remove references to cssBundleHref

  • import { cssBundleHref } from "@remix-run/css-bundle"; import type { LinksFunction } from "@remix-run/node"; // or cloudflare/deno

    export const links: LinksFunction = () => [

  • ...(cssBundleHref

  • ? [{ rel: "stylesheet", href: cssBundleHref }]
    
  • : []),
    

    // ... ];

和semi的官方文档冲突了,请问该怎么解决?

ReproducibleCode

import type { MetaFunction } from "@remix-run/cloudflare";
import {Button} from "@douyinfe/semi-ui";

export const meta: MetaFunction = () => {
  return [
    { title: "New Remix App" },
    {
      name: "description",
      content: "Welcome to Remix on Cloudflare!",
    },
  ];
};

export default function Index() {
  return (
   <>
     <Button>123</Button>
   </>
  );
}

Environment

- OS:windows
- browser:
edge

Anything else?

No response

favoritewky avatar Aug 23 '24 11:08 favoritewky