-
-
Notifications
You must be signed in to change notification settings - Fork 10
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
Vite build error: TypeError: PluginCritical is not a function #12
Comments
Got it to work with a workaround: (PluginCritical as any).default({
criticalUrl: '',
criticalBase: './',
criticalPages: [{ uri: '', template: 'index' }],
criticalConfig: {},
}), The |
Thanks! Works! |
hmmmm. I'm going to see if there's a way I can solve this at the plugin level |
Okay so I was already properly generating a CJS and ESM variants of the library, but I needed to add Conditional Exports as a hint to help with module resolution: https://nodejs.org/dist/latest-v18.x/docs/api/packages.html#conditional-exports So what was happening is it was doing an import of the CJS version of the library, which worked likely because of the Adding this to the project's "exports": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.js"
}, I'll roll out an update shortly. |
Released as 1.0.13 -> https://github.com/nystudio107/rollup-plugin-critical/releases/tag/1.0.13 |
Describe the bug
Cannot build Vite project when using this plugin in plugins section in vite.config.ts. It says
TypeError: PluginCritical is not a function
. What am I doing wrong? I tried rollup.config.js, but it looks like Vite is ignoring that file.Steps to reproduce
import PluginCritical from 'rollup-plugin-critical'
Screenshots
Versions
The text was updated successfully, but these errors were encountered: