简体   繁体   English

Monorepo:(NextJS 13 + Typescript)模块解析失败

[英]Monorepo: (NextJS 13 + Typescript) Module parse failed

I'm trying to move a currently working nextjs 13 app to a single monorepo.我正在尝试将当前正在运行的 nextjs 13 应用程序移动到单个 monorepo。 I basically created a new repo using npx create-turbo@latest and then moved my existing repo (lest call it "frontend") to the apps/ folder.我基本上使用npx create-turbo@latest创建了一个新的回购协议,然后将我现有的回购协议(以免称之为“前端”)移动到apps/文件夹。 After that i when and added on apps/frontend/package.json the 'ui' dependency:之后,我在apps/frontend/package.json上添加了“ui”依赖项:

{
    "name": "frontend",
    "version": "0.1.0",
    "private": true,
    "dependencies": {
        ...
        "ui": "*",
    }
    ...
}

and added on next.config.js the transpile option:并在next.config.js上添加了 transpile 选项:

experimental: {
    transpilePackages: ['ui'],
}

So far so good everything seems to be working.到目前为止,一切似乎都很好。 However after this i moved a component from my existing project to the UI folder, added all the corresponding dependencies and when i run it i get:然而,在此之后我将一个组件从我现有的项目移动到 UI 文件夹,添加了所有相应的依赖项,当我运行它时我得到:

frontend:dev: error - ../../packages/ui/Button/Button.tsx
frontend:dev: Module parse failed: The keyword 'interface' is reserved (11:0)
frontend:dev: You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
frontend:dev: | import classNames from 'classnames';

Am i missing any kind of configuration?我是否缺少任何配置?

Environment information环境信息

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 21.6.0: Mon Aug 22 20:19:52 PDT 2022; root:xnu-8020.140.49~2/RELEASE_ARM64_T6000
Binaries:
  Node: 16.13.2
  npm: 8.1.2
  Yarn: 1.22.19
  pnpm: N/A
Relevant packages:
  next: 13.0.4
  eslint-config-next: 12.3.4
  react: 18.2.0
  react-dom: 18.2.0

For anyone facing this issue.对于面临这个问题的任何人。 It was my fault cause i used npx create-turbo@latest to create the initial monorepo but then i forgot to upgrade to next13 my existing project right after moving it.这是我的错,因为我使用 npx create-turbo@latest 创建了初始的 monorepo,但后来我忘记在移动现有项目后立即升级到 next13。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM