Been trying to figure out how to set up a repo with yarn workspaces, webpack and typescript project references. Apologies if this is simply a configuration error on my part, but I'm unable to spot what I might have done wrong. Running on Windows 10
Expected Behaviour
Actual Behaviour
The first yarn build will fail with:
yarn run v1.22.4
$ webpack
Hash: 32473a9cdaa03043ec8e
Version: webpack 4.43.0
Time: 808ms
Built at: 05/21/2020 1:01:35 AM
Asset Size Chunks Chunk Names
../../b/dist/index.d.ts 53 bytes [emitted]
../../b/dist/index.js 149 bytes [emitted]
../../b/tsconfig.tsbuildinfo 6.3 KiB [emitted]
index.d.ts 11 bytes [emitted]
index.js 4.06 KiB main [emitted] main
Entrypoint main = index.js
[./src/index.ts] 140 bytes {main} [built] [1 error]
ERROR in ./src/index.ts
Module not found: Error: Can't resolve 'b' in '/c/coding/jedster1111/ts-loader-project-references/a/src'
@ ./src/index.ts 3:12-24
ERROR in /c/coding/jedster1111/ts-loader-project-references/a/src/index.ts
./src/index.ts
[tsl] ERROR in /c/coding/jedster1111/ts-loader-project-references/a/src/index.ts(1,32)
TS2307: Cannot find module 'b' or its corresponding type declarations.
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
If you check b/dist index.js does actually exist at this point.
If you run yarn build again, webpack will complete successfully.
Another interesting thing to note is if you update getMeaningOfLife to return 42. Build webpack and run the built index.js. I get the old value, 45. Re-run webpack and run the build file again, I now get 42.
It seems like the dependant projects are getting built, but not actually used in the webpack output.
Location of a Minimal Repository that Demonstrates the Issue.
https://github.com/jedster1111/ts-loader-project-references
Been trying to figure out how to set up a repo with yarn workspaces, webpack and typescript project references. Apologies if this is simply a configuration error on my part, but I'm unable to spot what I might have done wrong. Running on Windows 10
Expected Behaviour
Freshly clone https://github.com/jedster1111/ts-loader-project-references
yarn installyarn webpackwithin theaworkspacebto be built and write output files tob/dista/dist/index.jsnode index.jsinside ofa/distand see output45Change
b/src/index.tsgetMeaningOfLifeto return42yarn buildinside ofanode index.jsinside ofa/distand see output42Actual Behaviour
The first
yarn buildwill fail with:If you check
b/distindex.jsdoes actually exist at this point.If you run
yarn buildagain, webpack will complete successfully.Another interesting thing to note is if you update
getMeaningOfLifeto return42. Build webpack and run the builtindex.js. I get the old value,45. Re-run webpack and run the build file again, I now get42.It seems like the dependant projects are getting built, but not actually used in the webpack output.
Location of a Minimal Repository that Demonstrates the Issue.
https://github.com/jedster1111/ts-loader-project-references