Skip to content

Monorepo setup: unable to pin Typescript version relative to working directory #5086

Open
@AlexandreBonaventure

Description

@AlexandreBonaventure

Version

4.1.2

Reproduction link

https://github.com/AlexandreBonaventure/ts-monorepo-repro

Environment info

-

Steps to reproduce

I know this not strictly a vue-cli bug but in a monorepo setup (using yarn workspaces), I am unable to pin a specific version of typescript because there is seemingly no way to provide a configuration to explicitly do so. Basically, here we have to rely on node module resolution and package manager which is not deterministic.

Scenario 1: bare workspace setup

|_ node_modules
  |_ @vue
  |_ ts-loader
  |_ [email protected] <------ this typescript will always be used when compiling repro1 AND repro2
|_ apps
  |_ repro1 (requires [email protected])
  |_ repro2 (requires [email protected])
    |_ node_modules/[email protected] <-- this one should be used but because of @vue packages being hoisted up in the root, it won't

Scenario 2: using nohoist option

|_ node_modules
|_ apps
  |_ repro1 (requires [email protected])
  |_ repro2 (requires [email protected])
    |_ node_modules
        |_ @vue
           |_cli-plugin-typescript
              |_ node_modules
                |_ [email protected] <------ this typescript will be used by ts-loader is coming from devDepedencies of cli-plugin-typescript 
                |_ ts-loader
       |_ [email protected]

What is expected?

Ability to have control on using a typescript version specifically for each project

What is actually happening?

Difficult to do so


possible solutions could be :

  • plugin option to provide typescript binaries by ourselves
  • remove typescript devDepedencies in cli-plugin-typescript so we can use the yarn nohoist option

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions