✨ This workspace has been generated by Nx, a Smart, fast and extensible build system. ✨
I'm having two NextJS Apps with Tailwind setup.
For not duplicating the Tailwind configuration, I created a lib tailwind-config
and imported it in both apps.
The problem is, it can't be imported as @nextjs-tester/tailwind-config
The error is:
Module not found: Error: Can't resolve '@nextjs-tester/tailwind-config' in '...'
For me it seems more a quick fix and workaround than a solution.
- I added in both nextjs apps
project.json
files:
"dependsOn": [{ "target": "build", "projects": "tailwind-config" }],
- Therefore the
tailwind-config
lib is built before the nextjs apps. - Using the require on the dist-folder of the lib, it can be imported in the nextjs apps:
const myPreset = require('../../dist/libs/tailwind-config');
To start the development server run
nx serve nextjs-tester
nx serve my-second-app
Open your browser and navigate to http://localhost:4200/. Happy coding!