Comments (4)
However, requiring changes to source code will not help adoption.
One of the goals of Knip is absolutely to be as unobtrusive as possible (also see https://knip.dev/explanations/why-use-knip). But to handle each and every edge case in so many plugins (without including the ocean of tools themselves) is near impossible.
Another goal is to minimize configuration necessary on the user's end.
That said, once the plugins API is a bit more stable and more use cases better identified (this issue helps a lot with that!), there might be room to further improve Knip in this area.
from knip.
Detect or provide a way to pass env vars to webpack dependency resolution.
Not sure if/when Knip will feature custom configs for plugins. For now, I'd recommend to use a fallback value for things like env.variant ?? 'fallback/default-variant'
. Just to be clear: Knip certainly doesn't want to tell you how to do things, but for this seems to only way to circumvent the breakage? Another solution is to disable the plugin (webpack: false
).
As a side note, it would also be nice to configure CONFIG_FILE_PATTERNS as the webpack config files may be named differently if --config is passed.
You can do this today using webpack: 'webpack.config.js'
or webpack: { config: 'webpack.config.js' } }
in your Knip config. I realize now this should definitely be documented better.
from knip.
Detect or provide a way to pass env vars to webpack dependency resolution.
Not sure if/when Knip will feature custom configs for plugins. For now, I'd recommend to use a fallback value for things like
env.variant ?? 'fallback/default-variant'
. Just to be clear: Knip certainly doesn't want to tell you how to do things, but for this seems to only way to circumvent the breakage? Another solution is to disable the plugin (webpack: false
).
Thanks, indeed fallbacks is what I went for with my poc of introducing knip to a larger database. However, requiring changes to source code will not help adoption.
As a side note, it would also be nice to configure CONFIG_FILE_PATTERNS as the webpack config files may be named differently if --config is passed.
You can do this today using
webpack: 'webpack.config.js'
orwebpack: { config: 'webpack.config.js' } }
in your Knip config. I realize now this should definitely be documented better.
Thanks! Does that option support wildcards? We have split the config file to common, dev and prod.
from knip.
Thanks! Does that option support wildcards? We have split the config file to common, dev and prod.
Yes, globs.
from knip.
Related Issues (20)
- Warning "The CJS build of Vite's Node API is deprecated" HOT 2
- package.json scripts parsing issue when using --require in NODE_OPTIONS env variable HOT 3
- Jest configured setup scripts reporting as unused exports when --include-entry-exports is enabled HOT 6
- Allow other angular builders instead of default HOT 7
- False positive unused export reported in monorepo HOT 3
- default exported object does not track usage HOT 3
- Issues are not reported in monorepo when workspaces are setup in knip.json HOT 6
- Cannot run `pnpm create @knip/config` in nx monorepo root HOT 1
- TypeError: Cannot read properties of undefined (reading 'kind') HOT 9
- Knip doesn't work with a fresh NX(19.4.2) Angular(18) Monorepo HOT 1
- (GraphQL Codegen plugin): Support plugins whose package name does not start with `@graphql-codegen/` HOT 2
- Add all coreutils to `IGNORED_GLOBAL_BINARIES`
- unused exports within '.vue' files HOT 5
- Ignores not being honored for package.json scripts
- Monorepo package dev dependency binary used in GitHub actions workflow reported as unlisted HOT 2
- Get an issue count, when issues > 0 HOT 3
- cannot read the ESLint written in JS. HOT 1
- Knip doesn't parse arguments of `yarn run --top-level` correctly HOT 2
- 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
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.