-
Notifications
You must be signed in to change notification settings - Fork 0
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
Error plugin[name] is not a function
encountered when building with Vite/Vue3/Pug3
#1
Comments
The project is being supported, I still use it actively. This is likely due to the fact the package doesnt export an ES module, only CommonJS. I will investigate |
@Tempystral Okay it turns out you are just using the import statement incorrectly. The following should do the trick: import vuePugPlugin from 'vue-pug-plugin' |
Interesting, I had tried that as well and it didn't seem to be working, but I will investigate further on my end. I'll update later if I have more information -- thanks! |
Im using it with that syntax in a vite/vue3 project successfully. ES6/TS projects should be able to import CommonJS modules default exports like that with no issues |
I have updated my test project and am now seeing the same issue. Perhaps something has changed in vite or pug packages since last time I tested it. |
Actually nevermind @Tempystral - it was due to me updating to version 2.0.0 of this plugin, in which I changed the syntax. I would recommend you doing the same, updating to version 2.0.0 changing your code to the following import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import vuePugPlugin from "vue-pug-plugin";
export default defineConfig({
root: "./src",
build: {
outDir: "../dist",
emptyOutDir: true
},
plugins: [
vue({
template: {
preprocessOptions: {
plugins: [
vuePugPlugin,
]
}
}
})
]
}); |
I'll give that a try, thanks. I'll let you know the result when I have a moment to sit down and test. |
I can confirm it works, just had to make sure I was installing the new version. Thanks a million. |
@Tempystral you're welcome |
Hi, I'm having trouble getting this plugin to work. I'm packaging my app with Vite and followed the instructions on how to add the plugin. Whenever I try to run the dev server or build, I get the error that
"plugin[name]" is not a function
, and I confess I'm too inexperienced with the platform to say exactly why.My Vite config is very simple, not too different from the example except that I'm using Typescript and ES Modules, neither of which seem like they should interfere with this.
The error I get is the following:
Sorry, I know this is an old project and I understand if it's not being supported, but I would appreciate any insight on this issue.
The text was updated successfully, but these errors were encountered: