s-panferov / awesome-typescript-loader

Awesome TypeScript loader for webpack
Other
2.35k stars 179 forks source link

incompatibility with pnpm #641

Open andykais opened 5 years ago

andykais commented 5 years ago

pnpm is an alternative to npm that does not adhere to a flat node_modules structure. It instead organizes dependencies as a tree, only allowing files to require modules it explicitly depends on. This seems to cause an issue with awesome-typescript-loader. It fails to find the expected modules when looking at type declaration files. If I install the dependencies via npm, it succeeds. If I remove awesome-typescript-loader and build with webpack, treating the inputs as regular js, it succeeds.

I have created a repro repo https://github.com/andykais/pnpm-awesome-typescript-loader-error-repro/commit/1bebc0b662d1075d4f4a365ee78fed45b8f581df/checks#step:5:87

> pnpm-at-loader-fail@1.0.0 build /home/runner/work/pnpm-awesome-typescript-loader-error-repro/pnpm-awesome-typescript-loader-error-repro
> webpack --mode=development

ℹ 「atl」: Using typescript@3.5.3 from typescript
ℹ 「atl」: Using tsconfig.json from /home/runner/work/pnpm-awesome-typescript-loader-error-repro/pnpm-awesome-typescript-loader-error-repro/tsconfig.json
ℹ 「atl」: Checking started in a separate process...
 ✖ 「atl」: Checking finished with 6 errors
Hash: 83b60abbe2762d3916d5
Version: webpack 4.39.2
Time: 4887ms
Built at: 2019-08-21 15:04:02
        Asset      Size  Chunks             Chunk Names
    bundle.js  1.16 MiB    main  [emitted]  main
bundle.js.map   1.3 MiB    main  [emitted]  main
Entrypoint main = bundle.js bundle.js.map
[./node_modules/.registry.npmjs.org/webpack/4.39.2_webpack@4.39.2/node_modules/webpack/buildin/global.js] (webpack)/buildin/global.js 472 bytes {main} [built]
[./node_modules/.registry.npmjs.org/webpack/4.39.2_webpack@4.39.2/node_modules/webpack/buildin/harmony-module.js] (webpack)/buildin/harmony-module.js 573 bytes {main} [built]
[./src/index.ts] 121 bytes {main} [built]
    + 46 hidden modules

ERROR in [at-loader] ./node_modules/@types/react/index.d.ts:28:22 
    TS2307: Cannot find module 'csstype'.

ERROR in [at-loader] ./node_modules/@types/react/index.d.ts:29:28 
    TS2307: Cannot find module 'prop-types'.

ERROR in [at-loader] ./node_modules/redux/index.d.ts:149:11 
    TS2339: Property 'observable' does not exist on type 'SymbolConstructor'.

ERROR in [at-loader] ./node_modules/redux/index.d.ts:247:11 
    TS2339: Property 'observable' does not exist on type 'SymbolConstructor'.

ERROR in [at-loader] ./node_modules/redux/index.d.ts:1:23 
    TS2688: Cannot find type definition file for 'symbol-observable'.

ERROR in [at-loader] ./node_modules/@types/react-redux/index.d.ts:42:39 
    TS2307: Cannot find module 'hoist-non-react-statics'.
 ERROR  Command failed with exit code 2.
##[error]Process completed with exit code 1.
KaboomFox commented 5 years ago

@andykais what are you doing to fix this? Are you using a different loader?

andykais commented 5 years ago

@KaboomFox yes, for the time being I am using ts-loader, which does not have this issue.