S
S
Speakermen2021-10-26 03:06:08
Node.js
Speakermen, 2021-10-26 03:06:08

How to set an alias for the path '../../../../prisma/prisma.module'?

Have n't figured out nx

olympus-social-network

prisma/index.js yet

export * from './prisma.service';
export * from './prisma.module';


import { Module } from '@nestjs/common';

import { AppController } from './app.controller';
import { AppService } from './app.service';
import { PostsController, PostsService } from '@olympus/posts';
//import { PrismaModule } from '../../../../prisma/prisma.module'; //Так работает
import { PrismaModule } from '@olympus/prisma'; // Так нет

@Module({
  imports: [PrismaModule],
  controllers: [AppController, PostsController],
  providers: [AppService, PostsService],
})
export class AppModule {}


I think tsconfig.base.json is responsible for this
{
  "compileOnSave": false,
  "compilerOptions": {
    "rootDir": ".",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "importHelpers": true,
    "target": "es2015",
    "module": "esnext",
    "lib": ["es2017", "dom"],
    "skipLibCheck": true,
    "skipDefaultLibCheck": true,
    "baseUrl": ".",
    "paths": {
      "@olympus/posts": ["libs/posts/src/index.ts"],
      "@olympus/prisma": ["prisma/index.ts"]
    }
  },
  "exclude": ["node_modules", "tmp"]
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
lssssssssssl, 2021-10-26
@Speakermen

You can do it like this:
Create a library for a prism with a nestjs schematic (If you use nest):
command nx g @nrwl/nestjs:lib prisma, if my memory serves me right.
This is how
ps works Here in the models-prisma section you can see how to set up migrations.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question