File tree Expand file tree Collapse file tree
packages/cli/snap-tests/vite-plugins-sync Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <!doctype html>
2+ < html >
3+ < body >
4+ < script type ="module ">
5+ console . log ( 'hello' ) ;
6+ </ script >
7+ </ body >
8+ </ html >
Original file line number Diff line number Diff line change 1+ export default function mySyncPlugin ( ) {
2+ return {
3+ name : 'my-sync-plugin' ,
4+ transformIndexHtml ( html : string ) {
5+ return html . replace ( '</body>' , '<!-- sync-plugin-injected --></body>' ) ;
6+ } ,
7+ } ;
8+ }
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " vite-plugins-sync-test" ,
3+ "private" : true
4+ }
Original file line number Diff line number Diff line change 1+ > # Test that plugins loaded via sync vitePlugins() are applied during build
2+ > vp build
3+ > cat dist/index.html | grep 'sync-plugin-injected'
4+ <!-- sync-plugin-injected --></body>
Original file line number Diff line number Diff line change 1+ {
2+ "commands" : [
3+ " # Test that plugins loaded via sync vitePlugins() are applied during build" ,
4+ {
5+ "command" : " vp build" ,
6+ "ignoreOutput" : true
7+ },
8+ " cat dist/index.html | grep 'sync-plugin-injected'"
9+ ]
10+ }
Original file line number Diff line number Diff line change 1+ import { defineConfig , vitePlugins } from 'vite-plus' ;
2+ import mySyncPlugin from './my-plugin' ;
3+
4+ export default defineConfig ( {
5+ plugins : vitePlugins ( ( ) => [ mySyncPlugin ( ) ] ) ,
6+ } ) ;
You can’t perform that action at this time.
0 commit comments