4

I've read these similar questions:

In my Typescript project, I have two directories:

core/
  package.json
  ...
app/
  package.json
  ...

Within app/ I have installed the core/ module using yarn like this:

yarn add file:../core

which shows up in app/package.json as:

{
  ...
  "dependencies": {
    ...
    "my-core": "file:../core",
    ...
  }
}

On macOS and Linux, running tsc from within app/ works fine. But when I run tsc on Windows, I get this:

C:\proj\app>cmd /c yarn compile 
yarn compile v0.27.5
$ cross-env NODE_ENV=production tsc
src/thing/appstate.ts(4,29): error TS2307: Cannot find module 'my-core'.
error Command failed with exit code 2.

Here's my app/tsconfig.json:

{
  "compilerOptions": {
    "target": "es2017",
    "module": "umd",
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": true,
    "noImplicitAny": false,
    "noImplicitThis": false,
    "noUnusedLocals": true,
    "noUnusedParameters": false,
    "sourceMap": true,
    "jsx": "react",
    "listEmittedFiles": false,
    "lib": ["es2017", "dom"]
  },
  "include": [
    "src/**/*.ts",
    "src/**/*.tsx"
  ],
  "exclude": [
    "node_modules"
  ]
}

Is this a yarn bug? Or a Typescript bug? Or am I doing something wrong? :)

tk421
  • 5,775
  • 6
  • 23
  • 34
iffy
  • 719
  • 1
  • 4
  • 20

0 Answers0