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

Strange behavior with Project References on #997

Closed
kirill-konshin opened this issue Sep 11, 2019 · 18 comments
Closed

Strange behavior with Project References on #997

kirill-konshin opened this issue Sep 11, 2019 · 18 comments
Labels
pinned don't let probot-stale close

Comments

@kirill-konshin
Copy link

kirill-konshin commented Sep 11, 2019

I have a project where I'm using [email protected] with projectReferences: true and following tsconfig:

{
  "extends": "xxx/typescript/tsconfig.json",
  "compilerOptions": {
    "composite": true,
    "incremental": true,
    "tsBuildInfoFile": "./.tscache/tsconfig.tsbuildinfo",
    "target": "es5",
    "module": "commonjs",
    "baseUrl": ".",
    "rootDir": "./src",
    "outDir": "./lib",
    "declaration": true,
    "declarationDir": "./lib",
    "typeRoots": [
      "./node_modules/@types"
    ],
    "paths": {
      "web-modules-core": [
        "../core"
      ],
    }
  },
  "include": [
    "src/**/*.ts",
    "src/**/*.tsx"
  ],
  "references": [
    {
      "path": "../core"
    },
  ]
}

The project is a lerna monorepository.

On first build I get error that web-modules-core can't be resolved. Even though web-modules-core package (located in ../core) builds itself during the startup.

If I stop webpack and start it again it succeeds...

@johnnyreilly
Copy link
Member

Could you provide a minimal reproduction repo please?

cc @andrewbranch

@kirill-konshin
Copy link
Author

@johnnyreilly @andrewbranch I can create a private repo and add you there if this would work.

@kirill-konshin
Copy link
Author

kirill-konshin commented Sep 11, 2019

In fact, I was able to make it clean enough to be public: https://github.com/kirill-konshin/wmc-ts-bug

$ npm install
$ cd storybook
$ npm start

Which consistently results in

ERROR in /Users/dis/Sites/wmc-ts-bug/storybook/src/stories/Well.tsx
./src/stories/Well.tsx
[tsl] ERROR in /Users/dis/Sites/wmc-ts-bug/storybook/src/stories/Well.tsx(4,20)
      TS2307: Cannot find module 'web-modules-core'.

Then Ctrl+C to stop.

Then again:

$ npm start

This time it will work just fine.

It looks like ts-loader does not understand that web-modules-core package has been built, so Project References part worked well, you can see build artifacts in core folder.

In order to clean everything up use npx lerna run clean which will remove all build artifacts.

@johnnyreilly
Copy link
Member

Thanks @kirill-konshin!

@kirill-konshin
Copy link
Author

Any luck so far @johnnyreilly ?

@johnnyreilly
Copy link
Member

I'm not looking at this myself I'm afraid - completely snowed. It's possible it may be resolved by @sheetalkamat's work on #1003

@stale
Copy link

stale bot commented Nov 16, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Nov 16, 2019
@Bessonov
Copy link

Activity!

@stale stale bot removed the wontfix label Nov 16, 2019
@johnnyreilly
Copy link
Member

Do you know anything about this @andrewbranch? I haven't looked at this at all I'm afraid..

@jleider
Copy link

jleider commented Dec 3, 2019

I filed a similar bug a while ago: #1005 and I'm just now getting back to trying to implement project references again. As you state the first build fails but still produces the referenced projects definition files. Thats why the second build succeeds because those definition files are available at the onset of the compilation the second time around. It seems like a race condition or caching issue on ts-loader's part since the project references work just fine using tsc --build

@stale
Copy link

stale bot commented Feb 1, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Feb 1, 2020
@Bessonov
Copy link

Bessonov commented Feb 1, 2020

For the community the stale bots and friends are the worst thing ever :/

@stale stale bot removed the wontfix label Feb 1, 2020
@stale
Copy link

stale bot commented Apr 1, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Apr 1, 2020
@Bessonov
Copy link

Bessonov commented Apr 1, 2020

Let's notify everyone just for fun and stale bot. Do you like it, do you? I don't know why @johnnyreilly think that stale bot is a good idea.

@stale stale bot removed the wontfix label Apr 1, 2020
@andrewbranch andrewbranch added the pinned don't let probot-stale close label Apr 1, 2020
@andrewbranch
Copy link
Contributor

I’ve pinned it to keep the bot from marking it as stale again.

Keep in mind that ts-loader is maintained in the spare time of folks who have full-time jobs, and for many years, that has overwhelmingly been @johnnyreilly. I can’t speak for him, but I don’t currently don’t have the time or energy to devote to this issue. I understand your frustration, but, I’d wager that any tool that lets @johnnyreilly volunteer his time to this project without it taking over his life and becoming unmanageable is a net win for the community.

Expressing your frustration is ok, and it’s useful to know people still care about this issue. I’d just also remind you that a) it’s not anybody’s job to do this, and b) it can be anybody’s job to do this—it’s open source, and if you open a PR, I would make time to review it 🙂

@Bessonov
Copy link

Bessonov commented Apr 2, 2020

Don't get me wrong. It was sarcastic. I'm not frustrated about no movement in this issue. But I'm very frustrated about stale bot virus in open source space. I bored to say "I'm interested to leave this issue open" and spam every subscriber or be spammed from other people who comment issues just to let it alive. From my point of view, there is no point to have stale bot - close issue or let it open. But please, stop this virus.

But, well, thanks for pinning the issue.

@appzuka
Copy link
Member

appzuka commented Jul 12, 2020

This seems to have been fixed by PR #1136 by @sheetalkamat. This was to fix #1114 which had the same symptoms you reported. Your repo does not seem to have the symlinks present in #1114, which were reported to be causing the issue. However, the changes made to fix that issue may have also fixed yours.

I cloned your wmc-ts-bug repo, upgraded ts-loader to 8.0.0 and typescript to 3.9.3. It then builds and runs without error.

@andrewbranch
Copy link
Contributor

Fantastic! Thanks for investigating @appzuka! Sounds like we can close this then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pinned don't let probot-stale close
Projects
None yet
Development

No branches or pull requests

6 participants