question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[purge-icons-webpack-plugin] TypeError: PurgeIconsPlugin is not a constructor

See original GitHub issue

I use purge-icons-webpack-plugin, but throw TypeError: PurgeIconsPlugin is not a constructor error:

const PurgeIconsPlugin = require('purge-icons-webpack-plugin')

module.exports = {
  // ...options
  plugins: [
    new PurgeIconsPlugin({
      /* PurgeIcons Options */
    })
  ]
}

Later I changed this code to run:

const PurgeIconsPlugin = require('purge-icons-webpack-plugin').default

// ...

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
antfucommented, Sep 16, 2020

Added in v0.4.1. It’s backward compatible, so the existing .default should also work.

1reaction
antfucommented, Sep 16, 2020

Guys, what do you think if we change the API to:

const { PurgeIcons } = require('purge-icons-webpack-plugin')
// or
import { PurgeIcons } from 'purge-icons-webpack-plugin'
Read more comments on GitHub >

github_iconTop Results From Across the Web

'Purgecss is not a constructor' when following the JS API ...
Hi, I'm trying to follow the ES5 JS API examples but it looks like something is going wrong with the export as I'm...
Read more >
Webpack 5 - PurgeCss - Not a Constructor Error
So apparently this is a webpack-purgecss-plugin 5.0 issue since webpack 5.0 So I downgraded the plugin to 4.1.3 and it works again.
Read more >
purgecss-webpack-plugin - npm
PurgeCSS plugin for webpack - Remove unused css. ... TypeScript icon, indicating that this package has built-in type declarations.
Read more >
PurgeCSSPlugin.(constructor)
PurgeCSSPlugin.(constructor). Constructs a new instance of the PurgeCSSPlugin class. Signature: constructor(options: UserDefinedOptions); ...
Read more >
Eliminating Unused CSS - SurviveJS
The functionality can be enabled through purgecss-webpack-plugin. At best, PurgeCSS can eliminate most, if not all, unused CSS rules. Critical path rendering is ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found