Git Product home page Git Product logo

nrwl / nx-recipes Goto Github PK

View Code? Open in Web Editor NEW
249.0 15.0 69.0 13.94 MB

πŸ§‘β€πŸ³ Common recipes to productively use Nx with various technologies and in different setups. Made with ❀️ by the Nx Team

Home Page: https://nx.dev

TypeScript 73.78% JavaScript 3.35% CSS 5.60% HTML 1.76% Vue 11.65% Astro 1.16% Svelte 0.52% Rust 0.34% Go 1.10% C# 0.74%
ci developer-tools fast monorepo nx smart

nx-recipes's Introduction

nx-recipes's People

Contributors

barbados-clemens avatar coly010 avatar idsme avatar isaacplmann avatar jaysoo avatar juristr avatar mandarini avatar ndcunningham avatar ruheni avatar zackderose avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nx-recipes's Issues

[vite] Internal server error: Failed to resolve entry for package "xxx/nx-recipes/standalone-react-app/cart". The package may have incorrect main/module/exports specified in its package.json.

the problem of ”standalone react app":

I input the url "http://localhost:4200/cart", then click the chrome's refresh button, then error " [vite] Internal server error: Failed to resolve entry for package "/Users/sxj/Desktop/self-learning/nx-recipes/standalone-react-app/cart". The package may have incorrect main/module/exports specified in its package.json." will happen.

The error detail:
4:19:56 PM [vite] Internal server error: Failed to resolve entry for package "/Users/sxj/Desktop/self-learning/nx-recipes/standalone-react-app/cart". The package may have incorrect main/module/exports specified in its package.json. at packageEntryFailure (file:///Users/sxj/Desktop/self-learning/nx-recipes/standalone-react-app/node_modules/[email protected]@vite/dist/node/chunks/dep-5605cfa4.js:34107:11) at resolvePackageEntry (file:///Users/sxj/Desktop/self-learning/nx-recipes/standalone-react-app/node_modules/[email protected]@vite/dist/node/chunks/dep-5605cfa4.js:34104:5) at tryResolveFile (file:///Users/sxj/Desktop/self-learning/nx-recipes/standalone-react-app/node_modules/[email protected]@vite/dist/node/chunks/dep-5605cfa4.js:33717:38) at tryFsResolve (file:///Users/sxj/Desktop/self-learning/nx-recipes/standalone-react-app/node_modules/[email protected]@vite/dist/node/chunks/dep-5605cfa4.js:33699:16) at Context.resolveId (file:///Users/sxj/Desktop/self-learning/nx-recipes/standalone-react-app/node_modules/[email protected]@vite/dist/node/chunks/dep-5605cfa4.js:33516:28) at Object.resolveId (file:///Users/sxj/Desktop/self-learning/nx-recipes/standalone-react-app/node_modules/[email protected]@vite/dist/node/chunks/dep-5605cfa4.js:40462:46) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async ModuleGraph.resolveUrl (file:///Users/sxj/Desktop/self-learning/nx-recipes/standalone-react-app/node_modules/[email protected]@vite/dist/node/chunks/dep-5605cfa4.js:60809:26) at async ModuleGraph.getModuleByUrl (file:///Users/sxj/Desktop/self-learning/nx-recipes/standalone-react-app/node_modules/[email protected]@vite/dist/node/chunks/dep-5605cfa4.js:60681:23) at async doTransform (file:///Users/sxj/Desktop/self-learning/nx-recipes/standalone-react-app/node_modules/[email protected]@vite/dist/node/chunks/dep-5605cfa4.js:36831:20)
ζˆͺ屏2023-01-15 δΈ‹εˆ4 36 02

I input the url "http://localhost:4200", then click the "View Cart" link, the error will not happen. why?
ζˆͺ屏2023-01-15 δΈ‹εˆ4 29 50

document implicitDependencies vs dependsOn for nestjs-prisma recipe

As a NX beginner it'd be nice to know if i should use dependsOn for this recipe, and also if I should add an output dir so that our team can get distributed task caching? (we have 50 or so schema.prisma files so caching would help, some of them take 5-10 seconds to generate for different architectures, and we all ways get cache miss obviously).

There are times when the app is affected, or needs to serve or build, but prisma generate hasn't been run, which will cause an error.

The nestjs-prisma recipe uses implicitDependencies for the schema lib since it does code generation, however, should we also consider using dependsOn relationships? Also, i'd like to see a comment in the readme about the relationships, why they're important to the recipe for those who are less familiar with NX.

An example of using depends on for my-apps build target would be:

"dependsOn": [
{
"projects": ["my-app-schema"],
"target": "prisma-generate"
},
{
"projects": ["my-app-analytics-schema"],
"target": "prisma-generate"
}
],

The issue this dependsOn solves is that otherwise people could build or serve the app and it would break if they forgot to generate. Also in CI/CD, since the node_modules is git ignored, generation is required. However the nx affected command doesn't re-generate the schema if it hasn't changed, even if the app requires it.

example links for reference:

https://github.com/nrwl/nx-recipes/blob/5bd23b05f6dda02fc2aeec0815ba13facf5a4251/nestjs-prisma/libs/prisma-schema-one/project.json#L13C4-L18C7

"implicitDependencies": ["prisma-schema-one"]

"implicitDependencies": ["prisma-schema-one"]

The table `main.User` does not exist in the current database.

Hi, I just downloaded your repository and tried to run nestjs-prisma. While trying to create a user, I encountered the following error:
The table `main.User` does not exist in the current database.

Am I the only one affected by this error?

Also probably something is not working with prisma 5.10.2. When you run the serve command the error is as follows:
Error: Cannot find module 'nx-recipes/nestjs-prisma/node_modules/@prisma/client/one'

Unable to start nestjs-prisma cannot find module nx-recipes/nestjs-prisma/node_modules/@prisma/client/one

After cloning and instal, I ran the following command with the result:
gesthairhome@mbp-de-patrick nestjs-prisma % cp .env.example .env
gesthairhome@mbp-de-patrick nestjs-prisma % nx run-many -t migrate

βœ”  nx run prisma-schema-two:migrate (2s)
βœ”  nx run prisma-schema-one:migrate (2s)

β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”

NX Successfully ran target migrate for 2 projects (3s)

gesthairhome@mbp-de-patrick nestjs-prisma % nx serve api

nx run api:serve:development

chunk (runtime: main) main.js (main) 23.5 KiB [entry] [rendered]
webpack compiled successfully (43048f463d3f7801)
Debugger listening on ws://localhost:9229/e3c18e9b-1bc0-40ce-b1d5-76f419c3029c
Debugger listening on ws://localhost:9229/e3c18e9b-1bc0-40ce-b1d5-76f419c3029c
For help, see: https://nodejs.org/en/docs/inspector

Error: Cannot find module '/Users/gesthairhome/Applis/nx-recipes/nestjs-prisma/node_modules/@prisma/client/one'
at createEsmNotFoundErr (node:internal/modules/cjs/loader:1181:15)
at finalizeEsmResolution (node:internal/modules/cjs/loader:1169:15)
at resolveExports (node:internal/modules/cjs/loader:591:14)
at Function.Module._findPath (node:internal/modules/cjs/loader:668:31)
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1130:27)
at Function.Module._load (node:internal/modules/cjs/loader:985:27)
at Function.Module.load (/Users/gesthairhome/Applis/nx-recipes/nestjs-prisma/node_modules/.pnpm/@nx[email protected]@types[email protected][email protected][email protected]/node_modules/@nx/js/src/executors/node/node-with-require-overrides.js:18:31)
at Module.require (node:internal/modules/cjs/loader:1235:19)
at require (node:internal/modules/helpers:176:18)
at Array.Object.defineProperty.value (/Users/gesthairhome/Applis/nx-recipes/nestjs-prisma/dist/apps/api/webpack:/external commonjs "@prisma/client/one":1:1)

NX Process exited with code 1, waiting for changes to restart...

I have check directory '/Users/gesthairhome/Applis/nx-recipes/nestjs-prisma/node_modules/@prisma/client/one' exist

nestjs-prisma example doesn't work out of the box

nestjs-prisma example doesn't work out of the box.

Steps:

  • yarn
  • nx run-many -t generate-types
  • nx serve api

Getting error:

Error: Cannot find module '/home/user/examples/nx-recipes/nestjs-prisma/node_modules/@prisma/client/one'
    at createEsmNotFoundErr (node:internal/modules/cjs/loader:1181:15)
    at finalizeEsmResolution (node:internal/modules/cjs/loader:1169:15)
    at resolveExports (node:internal/modules/cjs/loader:591:14)
    at Function.Module._findPath (node:internal/modules/cjs/loader:668:31)
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1130:27)
    at Function.Module._load (node:internal/modules/cjs/loader:985:27)
    at Function.Module._load (/home/user/examples/nx-recipes/nestjs-prisma/node_modules/@nx/js/src/executors/node/node-with-require-overrides.js:18:31)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Array.Object.defineProperty.value (/home/user/examples/nx-recipes/nestjs-prisma/dist/apps/api/webpack:/external commonjs "@prisma/client/one":1:1)

Node: 20.11.1
WSL 2.1.5.0

Trying to use prisma with custom output path like:
output = "../../../node_modules/@prisma/client/registration"
importing it like
import { PrismaClient } from '@prisma/client/registration';
getting the same error:
'/home/user/project/platform/node_modules/@prisma/client/registration'

It works fine only if I reference it like
import { PrismaClient } from '../../../../node_modules/@prisma/client/registration';

Support for Remix v2 (with vite)

Is there any plan for integrating Remix v2 (which brings Vite opt-in)?
If possible supporting custom server as so far i haven't been able to create my own server instance (e.g: image requiring websockets or any 3rd party integration)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.