Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work with monorepo projects #253

Open
gjsoaresc opened this issue Feb 21, 2021 · 2 comments
Open

Doesn't work with monorepo projects #253

gjsoaresc opened this issue Feb 21, 2021 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@gjsoaresc
Copy link

Everytime the lib tries to get the relative main root so I had to change final configuration to work with.

My tsconfig.json
image

Configuration assign
image

@dhkatz
Copy link
Collaborator

dhkatz commented Jul 12, 2021

Can you describe what you expect it to work like exactly? I'm not sure I understand how you are expecting it to work. I'd love to implement whatever functionality you need

@dhkatz dhkatz self-assigned this Jul 12, 2021
@dhkatz dhkatz added the bug Something isn't working label Jul 12, 2021
@japorized
Copy link

japorized commented Sep 23, 2021

I just tried this out as well.
I got this message:

Error: Unable to find the 'paths' property in the supplied configuration!

I believe the problem stems from the parser somehow just ending at resolving the base configuration (of which you extend).


Did a MWE. Suppose here's the setup.

.
├── gulpfile.js
├── package.json
├── src
│   ├── one
│   │   ├── index.ts
│   │   └── tsconfig.json
│   ├── two
│   └── shared
│       └── lib.ts
├── tsconfig.json
└── yarn.lock

tsconfig.json

{
  "compilerOptions": {
    "module": "esnext",
    "target": "esnext",
    "strict": true,
    "declaration": true,
    "removeComments": true,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "allowSyntheticDefaultImports": true,
    "sourceMap": true,
    "incremental": true
  }
}

and src/one/tsconfig.json

{
  "extends": "../../tsconfig.json",
  "compilerOptions": {
    "rootDir": "../",
    "outDir": "../dist/one",
    "paths": {
      "@/*": ["./*"],
      "@shared/*": ["../shared/*"]
    }
  },
  "includes": [
    "./",
    "../shared",
    "../node_modules"
  ],
  "exclude": [
    "../two"
  ]
}

Here's the gulp task for reference:

const tsProject = ts.createProject("./src/one/tsconfig.json");

gulp.task("ts-project", () => {
  const compilation = gulp
    .src("./src/one/**/*.ts")
    .pipe(alias(tsProject.config))
    .pipe(tsProject());

  return compilation.js.pipe(gulp.dest("./dist"));
});

Looks like the options in the resolveConfig function (this line) gives the following when you print it out.

{
  config: {
    compilerOptions: {
      module: 'esnext',
      target: 'esnext',
      strict: true,
      declaration: true,
      removeComments: true,
      moduleResolution: 'node',
      emitDecoratorMetadata: true,
      experimentalDecorators: true,
      allowSyntheticDefaultImports: true,
      sourceMap: true,
      incremental: true
    },
    compileOnSave: false
  },
  error: undefined
}

Could it perhaps be a problem upstream?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants