import { defineConfig } from 'umi' ; import path from 'path' ; import pxToViewPort from 'postcss-px-to-viewport-fixed' ; import MonacoWebpackPlugin from 'monaco-editor-webpack-plugin' ; export default defineConfig ( { history : { type : 'hash' , } , routes : [ { path : '/' , component : '@/layouts/index' , routes : [ { path : '/' , redirect : '/manage/page' } , { path : '/design' , component : '@/pages/design' } , { path : '/mobile' , component : '@/pages/mobile' } , { path : '/manage' , routes : [ { path : '/manage/category' , component : '@/pages/manage/category' } , { path : '/manage/component' , component : '@/pages/manage/component' } , { path : '/manage/component/detail' , component : '@/pages/manage/component/detail' } , { path : '/manage/page' , component : '@/pages/manage/page' } , ] } , ] , } , ] , ignoreMomentLocale : true , inlineLimit : false , title : '搭建' , alias : { '@src' : path . resolve ( __dirname , 'src' ) , } , extraPostCSSPlugins : [ pxToViewPort ( { viewportWidth : 750 , viewportHeight : 1334 , unitPrecision : 3 , viewportUnit : 'vw' , selectorBlackList : [ '.ignore' , '.hairlines' ] , minPixelValue : 1 , mediaQuery : false , include : /h5Lib/i , exclude : /node_modules/i , } ) , ] , chainWebpack : ( memo ) => { memo . plugin ( 'monaco-editor-webpack-plugin' ) . use ( MonacoWebpackPlugin , [ { languages : [ 'json' ] } ] ) ; return memo ; } , externals : { 'react' : 'window.React' , 'react-dom' : 'window.ReactDOM' , } , scripts : process . env . NODE_ENV === 'development' ? [ 'https://gw.alipayobjects.com/os/lib/react/16.13.1/umd/react.development.js' , 'https://gw.alipayobjects.com/os/lib/react-dom/16.13.1/umd/react-dom.development.js' , ] : [ 'https://gw.alipayobjects.com/os/lib/react/16.13.1/umd/react.production.min.js' , 'https://gw.alipayobjects.com/os/lib/react-dom/16.13.1/umd/react-dom.production.min.js' , ] , nodeModulesTransform : { type : 'none' , exclude : [ ] , } , } ) ;