Closed georgezouq closed 1 year ago
@georgezouq 我使用最新的 Taro 脚手架构建项目后,并安装该插件,但并未复现你说的问题,我需要更多的复现细节。
@SyMind 项目DEMO在这里 https://github.com/georgezouq/taro-nextjs-latest 又有了一些新的问题
CLI初始化参数
CLI版本:Taro v3.5.12
另外,请问,把基于 @tarojs/components 或者 taro-ui 并使用rollup编译后的组件库,直接用于一个 NextJS 的项目中是否可行?比如给 NextJS 的项目增加一些 babel 或者 webpack配置,或者在rollup编译阶段直接将组件编译成 H5版本?
想了解下插件是怎么让 tarojs 的 components 可以用在 nextjs 项目中的
谢谢啦!
@georgezouq 你的项目中存在以下问题:
pages/index/index.tsx
中引用 index.less
,受限于 Next.js 页面和组件级别样式只能使用 css module。pages/index/index.tsx
中按需要引用 taro-ui 的 css,只能在 app.ts
中引入全部样式。插件中存在以下问题:
@tarojs/components
和 @tarojs/taro
进行替换,一方面是没有考虑 CommonJS,另一方面是 Next.js 默认不会对 node_modules 中的依赖使用 babel 进行处理。最后: 由于 taro-ui 是 Taro 生态中十分流行的 ui 组件库,插件将内部对其进行支持,目前已经发布 v2.0.9 版本,请尝试使用,若存在问题欢迎告知我。
@georgezouq 我给了你 Demo 一个 PR:https://github.com/georgezouq/taro-nextjs-latest/pull/1 。
@SyMind 已合并 感谢!
Cannot find module '/node_modules/next/dist/compiled/sass-loader/fibers.js'