Closed ycs77 closed 4 years ago
I think this is a limitation for rollup when outputting in CJS. I don't see a proper way to solve this for now, if anyone knowing more context, please leave comments or just file a PR. Much appreciated.
One other way is to use TypeScript along with Webpack, if using TS works for you. https://webpack.js.org/guides/typescript/. With "esModuleInterop": true
set, it should work as you expected.
@ycs77 for me after switching to
const PurgeIconsPlugin = require('purge-icons-webpack-plugin').default
TypeError: Cannot read property 'data' of undefined
my setup is using "webpack": "^5.0.0-beta.29" with vue-loader
@antfu "esModuleInterop": true
didn't help for me
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'
Added in v0.4.1
. It's backward compatible, so the existing .default
should also work.
Great!
I use purge-icons-webpack-plugin, but throw
TypeError: PurgeIconsPlugin is not a constructor
error:Later I changed this code to run: