Next.js Discord

Discord Forum

cant build next js app in turbo repo

Unanswered
Giant Chinchilla posted this in #help-forum
Open in Discord
Avatar
Giant ChinchillaOP
Using Bun

$ turbo build
turbo 2.1.3

• Packages in scope: @v1/ai, @v1/api, @v1/db, @v1/geo, @v1/locale, @v1/reseller, @v1/stripe, @v1/supabase, @v1/tailwind, @v1/types, @v1/typescript, @v1/ui, @v1/upload, @v1/utils, web
• Running build in 15 packages
• Remote caching disabled
┌ web#build > cache miss, executing b828d43c34234f9f
│ $ next build
│   ▲ Next.js 14.2.6
│
│    Creating an optimized production build ...
│
│ > Build error occurred
│ SyntaxError: Invalid regular expression: /[/\\]node_modules[/\\](@v1[/\\]**|geist|lucide-react|date-fns|lodash-es|ramd
│ a|antd|react-bootstrap|ahooks|@ant-design[/\\]icons|@headlessui[/\\]react|@headlessui-float[/\\]react|@heroicons[/\\]react[ 
│ /\\]20[/\\]solid|@heroicons[/\\]react[/\\]24[/\\]solid|@heroicons[/\\]react[/\\]24[/\\]outline|@visx[/\\]visx|@tremor[/\\]r
│ eact|rxjs|@mui[/\\]material|@mui[/\\]icons-material|recharts|react-use|@material-ui[/\\]core|@material-ui[/\\]icons|@tabler
│ [/\\]icons-react|mui-core|react-icons[/\\]ai|react-icons[/\\]bi|react-icons[/\\]bs|react-icons[/\\]cg|react-icons[/\\]ci|re
│ act-icons[/\\]di|react-icons[/\\]fa|react-icons[/\\]fa6|react-icons[/\\]fc|react-icons[/\\]fi|react-icons[/\\]gi|react-icon
│ s[/\\]go|react-icons[/\\]gr|react-icons[/\\]hi|react-icons[/\\]hi2|react-icons[/\\]im|react-icons[/\\]io|react-icons[/\\]io
│ 5|react-icons[/\\]lia|react-icons[/\\]lib|react-icons[/\\]lu|react-icons[/\\]md|react-icons[/\\]pi|react-icons[/\\]ri|react
│ -icons[/\\]rx|react-icons[/\\]si|react-icons[/\\]sl|react-icons[/\\]tb|react-icons[/\\]tfi|react-icons[/\\]ti|react-icons[/
│ \\]vsc|react-icons[/\\]wi)[/\\]/: Nothing to repeat
│     at new RegExp (<anonymous>)
│     at getBaseWebpackConfig (C:\Users\lightest\Desktop\v1-refactor\v1-mono\node_modules\next\dist\build\webpack-config.js:647:36)
│     at C:\Users\lightest\Desktop\v1-refactor\v1-mono\node_modules\next\dist\build\webpack-build\impl.js:151:40
│     at async Span.traceAsyncFn (C:\Users\lightest\Desktop\v1-refactor\v1-mono\node_modules\next\dist\trace\trace.js:154:20)
│     at async webpackBuildImpl (C:\Users\lightest\Desktop\v1-refactor\v1-mono\node_modules\next\dist\build\webpack-build\impl.js:136:21)
│     at async Object.workerMain (C:\Users\lightest\Desktop\v1-refactor\v1-mono\node_modules\next\dist\build\webpack-build\impl.js:326:20) {
│   type: 'SyntaxError'
│ }


package.json
{
  "name": "web",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev --turbo --experimental-https",
    "build": "next build",
    "start": "next start",
    "lint": "biome lint",
    "format": "biome format --write .",
    "typecheck": "tsc --noEmit",
    "clean": "git clean -xdf .next .turbo node_modules"
  },
  "dependencies": {
    "@v1/reseller": "workspace:*",
    "@v1/api": "workspace:*",
    "@v1/db": "workspace:*",
    "@v1/supabase": "workspace:*",
    "@v1/tailwind": "workspace:*",
    "@v1/ui": "workspace:*",
    "@hookform/resolvers": "^3.9.0",
    "@plaiceholder/next": "^3.0.0",
    "@t3-oss/env-nextjs": "^0.11.1",
    "@tanstack/react-query": "^5.56.2",
    "@trpc/client": "next",
    "@trpc/react-query": "next",
    "@trpc/server": "next",
    "@turf/turf": "^7.1.0",
    "@uploadthing/react": "^7.0.3",
    "date-fns": "^4.1.0",
    "framer-motion": "^11.11.1",
    "fs": "^0.0.1-security",
    "geist": "^1.3.1",
    "lucide-react": "^0.447.0",
    "maplibre-gl": "^4.7.1",
    "next": "14.2.6",
    "next-international": "^1.2.4",
    "next-safe-action": "^7.9.3",
    "next-share": "^0.27.0",
    "next-themes": "^0.3.0",
    "nuqs": "^1.19.3",
    "plaiceholder": "^3.0.0",
    "react": "18.3.1",
    "react-dom": "18.3.1",
    "react-hook-form": "^7.53.0",
    "react-map-gl": "^7.1.7",
    "sharp": "^0.33.5",
    "superjson": "^2.2.1",
    "uploadthing": "^7.1.0"
  },
  "devDependencies": {
    "@v1/typescript": "workspace:*",
    "@types/node": "^20",
    "@types/react": "^18",
    "@types/react-dom": "^18",
    "typescript": "^5"
  }
}

7 Replies

Avatar
Giant ChinchillaOP
next.config.mjs
/** @type {import('next').NextConfig} */
const nextConfig = {
  images: {
    remotePatterns: [
      {
        protocol: "https",
        hostname: "utfs.io",
      },
      {
        protocol: "https",
        hostname: "picsum.photos",
      },
      {
        protocol: "https",
        hostname: "loremflickr.com",
      },
      {
        protocol: "https",
        hostname: "i.ebayimg.com",
      },
    ],
  },
  transpilePackages: ["@v1/**", "geist"],
};

export default nextConfig;
Avatar
for what do u need transpilePackages?
the native module for transpiling should work fine i think
i dont have any problems
can u remove that and try to build again?
Avatar
its useful for monorepos so you dont need to build your TS to JS, and instead just export the TS and nextjs will build it :)

just simplifies everything
Avatar
but isnt that a natively feature of tsc with workspaces? having the types for dev exported from the src and nextjs uses the build from tsc at buildtime or am i wrong