Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why can't I use this plugin with create-react-app ? #118

Open
kopax opened this issue Dec 26, 2020 · 0 comments
Open

Why can't I use this plugin with create-react-app ? #118

kopax opened this issue Dec 26, 2020 · 0 comments

Comments

@kopax
Copy link

kopax commented Dec 26, 2020

I am using create-react-app and react-app-rewired, I want to optimize my images assets, this is how I configure the plugins within config-overrides.js:

    config.plugins = (config.plugins || []).concat([
      // Make sure that the plugin is after any plugins that add images
      new ImageminPlugin({
        disable: process.env.NODE_ENV !== 'production', // Disable during development
        plugins: [
          imageminGifsicle({
            optimizationLevel: 1,
          }),
          imageminJpegtran(),
          imageminPngquant(),
          imageminSvgo(),
        ]
      }),
    ]);

I have tried without installing all the plugin manually but I kept having nothing and it seems dependencies were not even installed.

After checking the generated configuration, this is what I have :

    {
      "options": {
        "disable": false,
        "maxConcurrency": 8,
        "imageminOptions": {
          "plugins": [
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null
          ]
        },
        "externalImages": {
          "context": ".",
          "sources": [],
          "destination": ".",
          "fileName": null
        },
        "cacheFolder": null
      }
    }

Why does it fail to work ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant