Questions tagged [vite-plugin-development]

For questions about the development of vite plugins.

14 questions
3
votes
0 answers

How to inform vite it should HMR on source change with a custom loader?

I am writing a plugin to get all css values from a stylus file (https://gist.github.com/hl037/560b25c7ecab65bc4d2c709541794724) It works, however vite does not hot reload it when the style file has changed. How do you inform vite of the source file…
hl037_
  • 3,520
  • 1
  • 27
  • 58
1
vote
0 answers

Vite className autoprefixer

I'm trying to add prefix to each className. import { defineConfig } from 'vite'; import react from '@vitejs/plugin-react'; import prefix from './prefix.plugin'; export default defineConfig({ plugins: [prefix(), react()], }); export default…
1
vote
0 answers

"The requested module does not provide an export named 'default'", but export is provided - Self build NPM package

I am writing my first NPM package as a plugin for Vite. I had all the code in my plugin before in a separate file inside the same code base, but now I have split and separated it into a it's own nuget package. When I use the package in my sample…
0
votes
0 answers

Vite is not compiling my dynamic imports using vite-plugin-dynamic-import | JSX files

vite-plugin-dynamic-import is not working for JSX Files. component: import(./pages${route}.js), It working with .js extension but not working with.jsx Please help me, i have been stuck here for 2 days. Thanks in advance!
0
votes
0 answers

How should I apply the vue-fb-customer-chat plugin in my nuxt 3 project?

I already install the vue-fb-customer-chat in my nuxt 3 project, and do copy pasting the code from "plugins/vue-fb-customer-chat.js", import Vue from 'vue' import VueFbCustomerChat from 'vue-fb-customer-chat' Vue.use(VueFbCustomerChat, { page_id:…
0
votes
1 answer

vite-plugin-electron does not create nested folders inside main folder when it compiles

Im trying to struct my electron folder like this: but vite-plugin-electron doesn't create the api folder instead it compiles on the root folder: this is my vite config file: import { defineConfig } from "vite"; import electron from…
0
votes
0 answers

(vite) How to instantiate a virtual module as a Worker

I'm working on a plugin that requires a slightly contrived series of virtual-modules. virtual:module_1 Is a module that has to instantiate and talk to virtual:module_2 which is in a web worker. So, virtual:module_1 needs to somehow instantiate a…
Loris Sigrist
  • 64
  • 1
  • 5
0
votes
0 answers

Vite Plugin to create HTMLs files to be picked up by another plugin

I have been battling to create a plugin that can create some HTML files from JSON input. I plan to parse the JSON to get each page and then create a HTML asset for each, and the hope is for it to be then parsed by vite-plugin-handlebars before…
Phill Duffy
  • 2,805
  • 3
  • 33
  • 45
0
votes
0 answers

How to run a fetch inside a Vite Plugin

Am creating a vite plugin which will enable me to generate a sitemap for my website but am not finding how to make a fetch request using one of their many hooks. Am using simplecrawler module to run the fetch inside the plugin but it doesn't seem to…
Lucretius
  • 13
  • 1
  • 4
0
votes
0 answers

How do I apply transform on a specific module with rollup plugin

I'm making a rollup-compatible plugin in Vite. (so basically a rollup-plugin). I am using the transform hook in the plugin. The plugin takes a module name(as specified in package.json, for example "d3") as a parameter, and I want to use this…
Mahesh Bansod
  • 1,493
  • 2
  • 24
  • 42
0
votes
1 answer

How to adjust the vite logger via config plugin?

I created a plugin that changes the vite config of the app that uses it. Everything works but the custom logger function - why? Minimal example: export default function plugin(opts: PluginOptions): Plugin { const logger = createLogger('info', { …
leonheess
  • 16,068
  • 14
  • 77
  • 112
0
votes
0 answers

Vite Plugin SSR - critical style generation (VUE.js)

I'm using vite-plugin-ssr + vue-router and I want to implement critical styling. My project has a pages folder which has the following structure: pages/SomePage/index.vue