File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -390,6 +390,45 @@ export const plugins: Config['plugins'] = [
390
390
]
391
391
```
392
392
393
+ ### addVitePlugin
394
+
395
+ Register a Vite plugin to the ` vite.config.ts ` file.
396
+
397
+ > [ !IMPORTANT]
398
+ > This codemod expects the ` vite.config.ts ` file to exist and must have the ` export default defineConfig ` function call.
399
+
400
+ ``` ts
401
+ const transformer = new CodeTransformer (appRoot )
402
+ const imports = [
403
+ {
404
+ isNamed: false ,
405
+ module: ' @vitejs/plugin-vue' ,
406
+ identifier: ' vue'
407
+ },
408
+ ]
409
+ const pluginUsage = ' vue({ jsx: true })'
410
+
411
+ try {
412
+ await transformer .addVitePlugin (pluginUsage , imports )
413
+ } catch (error ) {
414
+ console .error (' Unable to register vite plugin' )
415
+ console .error (error )
416
+ }
417
+ ```
418
+
419
+ Output
420
+
421
+ ``` ts
422
+ import { defineConfig } from ' vite'
423
+ import vue from ' @vitejs/plugin-vue'
424
+
425
+ export default defineConfig ({
426
+ plugins: [
427
+ vue ({ jsx: true })
428
+ ]
429
+ })
430
+ ```
431
+
393
432
### addPolicies
394
433
Register AdonisJS bouncer policies to the list of ` policies ` object exported from the ` app/policies/main.ts ` file.
395
434
You can’t perform that action at this time.
0 commit comments