Skip to content

Commit

Permalink
build: add next transpile modules to solve monorepo issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgevrgs committed May 15, 2024
1 parent 76373d2 commit 30f2e1a
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 7 deletions.
9 changes: 8 additions & 1 deletion apps/nextjs/next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import nextTranspileModules from 'next-transpile-modules';
import { join } from 'path';
import { fileURLToPath } from 'url';

Expand All @@ -20,4 +21,10 @@ const nextConfig = {
},
};

export default nextConfig;
const withTm = nextTranspileModules([
'@libs/frontend',
'@libs/shared',
'@libs/backend',
]);

export default withTm(nextConfig);
1 change: 1 addition & 0 deletions apps/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"eslint-config-next": "12.3.0",
"jsdom": "20.0.0",
"next-connect": "0.13.0",
"next-transpile-modules": "^10.0.1",
"postcss": "8.4.38",
"react-test-renderer": "18.2.0",
"sass": "1.54.9",
Expand Down
7 changes: 3 additions & 4 deletions libs/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@
"license": "ISC",
"dependencies": {
"@libs/shared": "workspace:*",
"lodash.omit": "4.5.0",
"mongodb": "4.9.1",
"next": "14.2.3",
"sharp": "0.33.3"
},
"peerDependencies": {
"lodash.omit": "4.5.0",
"mongodb": "4.9.1"
},
"devDependencies": {
"@eslint/js": "^9.2.0",
"@types/lodash.omit": "4.5.9",
"eslint": "8.57.0",
"globals": "^15.2.0",
"typescript-eslint": "^7.9.0",
Expand Down
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"license": "MIT",
"private": true,
"scripts": {
"build": "pnpm -r --filter='./apps/*' run build",
"dev": "pnpm -r --filter='./apps/*' run dev",
"lint": "pnpm -r --filter='./apps/*' --filter=''./libs/* run lint",
"test": "vitest",
Expand All @@ -20,5 +21,10 @@
"@types/node": "18.7.16",
"typescript": "5.4.5",
"vitest": "1.6.0"
}
},
"workspaces": [
"apps/*",
"libs/*"
],
"packageManager": "[email protected]"
}
32 changes: 31 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 30f2e1a

Please sign in to comment.