@@ -11,52 +11,54 @@ import uno from 'unocss/vite';
1111import { defineConfig } from 'vite' ;
1212import { createSvgIconsPlugin } from 'vite-plugin-svg-icons' ;
1313import { ViteMinifyPlugin } from 'vite-plugin-minify' ;
14- import { reactPages } from '../src ' ;
14+ import { reactPages } from 'unplugin-react-pages ' ;
1515import pkg from './package.json' ;
1616
17- export default defineConfig ( {
18- base : process . env . VITE_APP_BASENAME || '/' ,
19- server : {
20- port : 15170 ,
21- } ,
22- define : {
23- 'process.env.PKG_NAME' : JSON . stringify ( pkg . name ) ,
24- 'process.env.PKG_VERSION' : JSON . stringify ( pkg . version ) ,
25- } ,
26- plugins : [
27- // plugins
28- react ( ) ,
29- mdx ( {
30- rehypePlugins : [
31- //
32- [
33- rehypeHighlight ,
34- {
35- detect : true ,
36- } as Parameters < typeof rehypeHighlight > [ 0 ] ,
17+ export default defineConfig ( ( config ) => {
18+ return {
19+ base : process . env . VITE_APP_BASENAME || '/' ,
20+ server : {
21+ port : 15170 ,
22+ } ,
23+ define : {
24+ PKG_NAME : JSON . stringify ( config . mode === 'test' ? 'pkg-name-for-test' : pkg . name ) ,
25+ PKG_VERSION : JSON . stringify ( config . mode === 'test' ? 'pkg-version-for-test' : pkg . version ) ,
26+ } ,
27+ plugins : [
28+ // plugins
29+ react ( ) ,
30+ mdx ( {
31+ rehypePlugins : [
32+ //
33+ [
34+ rehypeHighlight ,
35+ {
36+ detect : true ,
37+ } as Parameters < typeof rehypeHighlight > [ 0 ] ,
38+ ] ,
3739 ] ,
38- ] ,
39- } ) ,
40- uno ( ) ,
41- createSvgIconsPlugin ( {
42- iconDirs : [ path . resolve ( 'src/icons' ) ] ,
43- symbolId : 'icon-[dir]/[name]' ,
44- } ) ,
45- ViteMinifyPlugin ( {
46- minifyCSS : true ,
47- minifyJS : true ,
48- minifyURLs : true ,
49- removeComments : true ,
50- collapseWhitespace : true ,
51- removeScriptTypeAttributes : true ,
52- removeStyleLinkTypeAttributes : true ,
53- } ) ,
54- reactPages . vite ( {
55- debug : true ,
56- logLevel : 'info' ,
57- fileNames : {
58- page : [ 'page.mdx' , 'page.tsx' ] ,
59- } ,
60- } ) ,
61- ] ,
40+ } ) ,
41+ uno ( ) ,
42+ createSvgIconsPlugin ( {
43+ iconDirs : [ path . resolve ( 'src/icons' ) ] ,
44+ symbolId : 'icon-[dir]/[name]' ,
45+ } ) ,
46+ ViteMinifyPlugin ( {
47+ minifyCSS : true ,
48+ minifyJS : true ,
49+ minifyURLs : true ,
50+ removeComments : true ,
51+ collapseWhitespace : true ,
52+ removeScriptTypeAttributes : true ,
53+ removeStyleLinkTypeAttributes : true ,
54+ } ) ,
55+ reactPages . vite ( {
56+ debug : true ,
57+ logLevel : 'info' ,
58+ fileNames : {
59+ page : [ 'page.mdx' , 'page.tsx' ] ,
60+ } ,
61+ } ) ,
62+ ] ,
63+ } ;
6264} ) ;
0 commit comments