Closed gamesaucer closed 1 year ago
I'm sorry, but this title made me laugh. 😂
hi @gamesaucer
I've opened a PR that tries to reproduce the problem:
https://github.com/pzavolinsky/ts-unused-exports/pull/251
Indeed, including .js files is not something we currently support, but could be interesting to support it ...
I have a few questions - if we can work together, we can figure it out ...
--alllowJs
like:npx tsc --allowJs
For my PR, this mostly works - but does NOT copy over
index.js
.how do you get around this? or are you compiling some other way? 🤔
(my bad - I thought there was a index.js
in src)
2. How is the index.js
file executed? My understanding is, a JavaScript file that contains TypeScript cannot normally be run for example by Node or a browser... (it would need to be compiled to just JavaScript...)
(my bad - I thought there was a index.js
in src)
thanks for your collaboration, sean
ah - reading again.
The source is index.ts
not js
. ok!
update: added a itest to cover.
Fixed by #220. We released that in 8.0.2
Closing, unless new info comes in - thank you.
As it says in the title, according the the command output, every single export from every file in my project is unused. However, it has many imports and compiles just fine, so something strange is going on here.
I don't know if this is a configuration error or a bug, but either way, I'll give as much detail as I can in the hope that someone can find the issue and fix it / tell me how to work around it.
EDIT: I think it's caused by using a
.js
extension in my imports, but this is still valid TS and it's necessary to generate working JS code (JS requires that imports have the full filename including the extension, and the TS compiler doesn't add it when absent). This is a major oversight if this is indeed the reason it doesn't work.%appdata%\npm\node_modules
on myC:
drive.D:\xampp\htdocs\myproject
(I find placing the repo inside my webserver environment to be the most convenient way to debug my code)ts-unused-exports tsconfig.json
fromD:\xampp\htdocs\myproject
Project
package.json
:Project
tsconfig.json:
Import statement examples:
tsconfig.json
,package.json
,package-lock.json
,.eslintrc.json
,.eslintignore
,.gitignore
build/
folder, with all the.js
and.js.map
files generated when compiling.html/
folder, withindex.html
andmain.css
.src/
folderindex.ts
Game/
folderGame.ts
Entity/
,Component/
,System/
,UI/
folders, etc. (I'm not going to list all of them or all their contents, but this should give a decent impression of my project structure.)