Code Monkey home page Code Monkey logo

Comments (4)

webpro avatar webpro commented on September 24, 2024 1

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.

webpro avatar webpro commented on September 24, 2024

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.

rriski avatar rriski commented on September 24, 2024

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' or webpack: { 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.

webpro avatar webpro commented on September 24, 2024

Thanks! Does that option support wildcards? We have split the config file to common, dev and prod.

Yes, globs.

from knip.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.