简体   繁体   中英

Monorepo: (NextJS 13 + Typescript) Module parse failed

I'm trying to move a currently working nextjs 13 app to a single 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. After that i when and added on apps/frontend/package.json the 'ui' dependency:

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

and added on next.config.js the transpile option:

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:

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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