You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ts-loader compiles a lot more files than it should. ts-loader should only compile files known to webpack (e.g webpack.config.js entry + its children) (and/or files specified in tsconfig.json (*))
Setup:
webpack.config.js with an entry ./index.ts + ts-loader
a file fail.ts:
// Fail to compile with TypeScript with "'const' declarations must be initialized"// + is not imported by index.tsconstfail;
Results:
Case 1 no tsconfig.json
ERROR in error TS18002: The 'files' list in config file 'tsconfig.json' is empty.
ERROR in ./index.ts
Module build failed: error while parsing tsconfig.json
=> KO, ts-loader should work without a file tsconfig.json (or at least the error message is incorrect and should be "error: no tsconfig.json")
Case 2 empty tsconfig.json without files and include
ERROR in /Users/tanguy/flex-wrap-layout/src/fail.ts
(1,7): error TS1155: 'const' declarations must be initialized.
=> KO, this is the main case, fail.ts is not specified anywhere (tsconfig.json and webpack.config.js) so ts-loader should not compile it.
Case 3 tsconfig.json with files (*)
Case 3.1 files with index.ts ("files": ["index.ts"]): no error => this is OK
Case 3.2 files with index.ts and fail.ts ("files": ["index.ts", "fail.ts"]): fail.ts error => this is OK
Case 3.2bis "include": ["*.ts"]: does not compile fail.ts
(*) I even believe that ts-loader should totally ignore tsconfig.json files (but use compilerOptions of course) and only rely on webpack.config.js entry (and its imported children). This is what rollup-plugin-typescript2 does.
The text was updated successfully, but these errors were encountered:
ts-loader compiles a lot more files than it should. ts-loader should only compile files known to webpack (e.g webpack.config.js entry + its children) (and/or files specified in tsconfig.json (*))
Setup:
Results:
=> KO, ts-loader should work without a file tsconfig.json (or at least the error message is incorrect and should be "error: no tsconfig.json")
=> KO, this is the main case, fail.ts is not specified anywhere (tsconfig.json and webpack.config.js) so ts-loader should not compile it.
"files": ["index.ts"]
): no error => this is OK"files": ["index.ts", "fail.ts"]
): fail.ts error => this is OKComparison with rollup-plugin-typescript2:
[!] Error: couldn't find 'tsconfig.json'
"include": ["*.ts"]
: does not compile fail.ts(*) I even believe that ts-loader should totally ignore tsconfig.json files (but use compilerOptions of course) and only rely on webpack.config.js entry (and its imported children). This is what rollup-plugin-typescript2 does.
The text was updated successfully, but these errors were encountered: