Comments (7)
Thanks for the report, but I don't seem to be able to access the repro.
from knip.
Sorry. I've fixed the permissions (hopefully…)
(I don't know much about codesandbox, but is it possible to have the links from knip's doc to pre-include most of the needed sharing options?)
from knip.
I'm seeing both foo.js
and foo.ts
in the same directory, is that intentional?
from knip.
Ah 💡 So you're saying that export * from "./foo"
resolves as foo.js
and thus considers foo.ts
as ignored?
It is indeed my setup to keep everything in the same directory. This is for a library building and npm publish
takes care of only bundling the *.js
and *.d.ts
files, so I don't need a separate dist
directory.
from knip.
Ah 💡 So you're saying that
export * from "./foo"
resolves asfoo.js
and thus considersfoo.ts
as ignored?
Yeah, module resolution can only resolve to a single file, so the other will be ignored. There was a refactoring in module resolution, which was breaking for you for this reason.
It is indeed my setup to keep everything in the same directory. This is for a library building and
npm publish
takes care of only bundling the*.js
and*.d.ts
files, so I don't need a separatedist
directory.
This is not common afaic, might be confusing for consumers of your lib. I would recommend to separate source and build/distribution artifacts.
Either way, it confuses Knip as it wants only source files. It supports both JS and TS so what's truth here?
from knip.
🤔 At least I understand where the problem comes from and why it's messy (modules resolutionS in JS is 🙄).
Maybe it is indeed time for a long overdue overhaul of my library structure… The setup form 2017 might not make that much sense now 😖
from knip.
Let's blame TypeScript for not setting the default value of outDir
to e.g. ./dist/
:)
Going to close this one as "wontfix" or "invalid".
from knip.
Related Issues (20)
- False Positive for Namespace Import in Vue SFC with Script Setup HOT 3
- Most files are marked as unused when they actually are used HOT 5
- @public modifier does not work if the whole file is unused HOT 9
- New husky format does not work for binaries without 'npx' HOT 2
- Conditional required import not longer working HOT 10
- Running in production mode doesn't allow for easy tagging of internal-only files (as opposed to internal exports) HOT 4
- Packages re-exported under different name through typescript module declaration HOT 1
- vite-plugin-fast-react-svg integration HOT 2
- Knip doesn't resolve imports in Nuxt projects HOT 3
- circular dependencies making knip stuck HOT 6
- detect unused fields returned by setup function HOT 1
- Add support for electron and electron-vite HOT 1
- npm init @knip/config fails on SVN repository HOT 1
- @types/xxx dependencies reported as unused HOT 5
- Cannot run yarn create @knip/config in workspaces root HOT 1
- Add support for Vue composables unused properties detection HOT 1
- Plz know my ‘tsconfig.xyz.json’ HOT 2
- Umm... name may be offensive to Japanese people HOT 4
- 🔄 Issue links are broken HOT 3
- 🐛 False positive for `unlisted` when using package.json `exports` in tsconfig "types" field. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from knip.