craco-plugin-inspect-config
TypeScript icon, indicating that this package has built-in type declarations

0.3.0 • Public • Published

craco-plugin-inspect-config

Inspect your Craco, webpack, dev server, and Jest configs then write the output to a text file in the outputDir.

Install

npm install craco-plugin-inspect-config -D

Usage

Add the following to your craco.config.js file.

⚠️ The plugin is not enabled by default. You must turn it on when you want to use it.

const { inspectConfigPlugin } = require('craco-plugin-inspect-config');

module.exports = {
  // ...
  plugins: [
    // ... put it last
    {
      plugin: inspectConfigPlugin,
      options: {
        enabled: true,
      },
    },
  ],
  // ...
};

Options

This plugin accepts the options from util.inspect() and the following:

{
  enabled: boolean;
  outputDir: string | ((pluginOptions) => string);
  stringify: (config, inspectOptions) => string;
  getFilename: (name) => string;
}

If you provide your own stringify, also provide getFilename so you can customize the extension.

Example:

const { inspectConfigPlugin } = require('craco-plugin-inspect-config');

module.exports = {
  plugins: [
    {
      plugin: inspectConfigPlugin,
      options: {
        enabled: true,
        stringify: config => JSON.stringify(config, null, 2),
        getFilename: name => `${name}.json`,
      },
    },
  ],
};

Package Sidebar

Install

npm i craco-plugin-inspect-config

Weekly Downloads

0

Version

0.3.0

License

MIT

Unpacked Size

5.93 kB

Total Files

4

Last publish

Collaborators

  • webdeveric