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

"extendDefaultPlugins utility is deprecated" warning #6744

Closed
astegmaier opened this issue Aug 20, 2021 · 4 comments · Fixed by #6785
Closed

"extendDefaultPlugins utility is deprecated" warning #6744

astegmaier opened this issue Aug 20, 2021 · 4 comments · Fixed by #6785

Comments

@astegmaier
Copy link
Contributor

astegmaier commented Aug 20, 2021

🐛 bug report

When running parcel build on a project with a no cache, @parcel/optimizer-htmlnano logs a message that the "extendDefaultPlugins" utility is deprecated. The error does not appear if you re-build with a warm cache. It looks like this may have been hit by someone else incidentally while debugging #6730 (which is a different issue)

🎛 Configuration (.babelrc, package.json, cli command)

package.json:

{
  "scripts": {
    "build": "parcel build src/index.html",
  },
  "devDependencies": {
    "parcel": "2.0.0-rc.0",
  },
  "browserslist": "> 0.5%, last 2 versions, not dead"
}

index.html

<!DOCTYPE html>
<html lang="en">
  <body>
    <h1>Test HTML Page with SVG</h1>
    <img src="test.svg" />
  </body>
</html>

🤔 Expected Behavior

Running yarn build does not produce deprecation warnings.

😯 Current Behavior

When you run yarn build on a project with a clean cache, you see this:

$ parcel build src/index.html

console: 
"extendDefaultPlugins" utility is deprecated.
Use "preset-default" plugin with overrides instead.
For example:
{
  name: 'preset-default',
  params: {
    overrides: {
      // customize plugin options
      convertShapeToPath: {
        convertArcs: true
      },
      // disable plugins
      convertPathData: false
    }
  }
}

✨ Built in 1.05s

dist/index.html             190 B    531ms
dist/test.e48e572b.svg    2.81 KB    479ms
✨  Done in 1.49s.

If you run yarn build again with a warm cache, the warning will not appear. To see it again, delete the .parcel-cache folder.

💁 Possible Solution

Use preset-default to configure svgo.

🔦 Context

There's no problems that I've noticed so far with the build output, but it might break in the future if it's deprecated.

💻 Code Sample

You can repro the issue using this repo

🌍 Your Environment

Software Version(s)
Parcel 2.0.0-rc.0
Node 14.17.5
Yarn 1.22.11
Operating System OS X 11.5.2
@mischnic
Copy link
Member

Instead of

plugins: extendDefaultPlugins([

it should instead use

   plugins: {
      name: 'preset-default',
      overrides: {
        ...
      }
    }

as introduced by
svg/svgo#1513

(But we need to make sure that the svgo dependency semver range of htmlnano also supports this in every case.)

@astegmaier
Copy link
Contributor Author

@mischnic - I made that change in this branch, and it appears to work fine when I yarn link the local build to a test project, but it causes some unit tests to fail - I think something might be getting messed up with the unit tests somehow running with an earlier version of svgo, maybe because of the worry you mentioned about htmlnano not yet supporting the latest version of svgo. I'll debug more next week, but I wanted to share progress in case someone else is looking at this and wants a starting place.

@isanchezd
Copy link

Someone know about this issue?

I have a personal project and i´m migrating from parcel V1 to V2 and i have this issue

Thanks!

@jeffpeck10x
Copy link
Contributor

@isanchezd1988 It is resolved in the latest parcel nightly branch.

yarn add --dev parcel@nightly

However, it is just a warning and can ignored.

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

Successfully merging a pull request may close this issue.

4 participants