| | |
| | | import IconsResolver from 'unplugin-icons/resolver' |
| | | import Icons from 'unplugin-icons/vite' |
| | | import { ElementPlusResolver } from 'unplugin-vue-components/resolvers' |
| | | // 兼容低版本浏览器 |
| | | import legacy from '@vitejs/plugin-legacy' |
| | | // 打包 兼容低版本浏览器 |
| | | // import legacy from '@vitejs/plugin-legacy' |
| | | // 开发环境兼容 |
| | | import esbuild from 'rollup-plugin-esbuild' |
| | | const pathSrc = path.resolve(__dirname, 'src') |
| | | |
| | | // https://vitejs.dev/config/ |
| | | export default defineConfig({ |
| | | base:'./', |
| | | server: { |
| | | proxy: { |
| | | '/v1/': { |
| | | target: 'http://192.168.20.119:8003', |
| | | '/api-s/': { |
| | | // http://192.168.20.119:8003 http://192.168.20.25:7010 |
| | | //target: 'http://192.168.20.119:9081', |
| | | target:'http://pad.fai365.com', |
| | | ws: true, |
| | | changeOrigin: true |
| | | }, |
| | | '/api': { |
| | | // http://192.168.20.119:8003 http://192.168.20.25:7010 |
| | | target:'http://pad.fai365.com', |
| | | ws: true, |
| | | changeOrigin: true |
| | | } |
| | |
| | | resolve: { |
| | | alias: { |
| | | '@': pathSrc |
| | | }, |
| | | } |
| | | }, |
| | | |
| | | |
| | | build: { |
| | | target:['chrome52'], |
| | | cssTarget:["chrome52"], |
| | | minify: 'terser', |
| | | // ,'edge90','firefox90','safari15' |
| | | target: ['chrome52'], |
| | | cssTarget: ['chrome52'] |
| | | }, |
| | | css: { |
| | | postcss: { |
| | | plugins: [ |
| | | require('postcss-pxtorem')({ |
| | | // ipad:1280-800 |
| | | rootValue: 160.0, //换算的基数, 屏幕宽度/10 |
| | | propList: ['*'] //需要转化的属性,*表示所有属性都需要转化 |
| | | // unitPrecision:5 |
| | | }) |
| | | ] |
| | | } |
| | | }, |
| | | plugins: [ |
| | | vue(), |
| | |
| | | |
| | | dts: path.resolve(pathSrc, 'auto-imports.d.ts') |
| | | }), |
| | | |
| | | // 兼容低版本浏览器 |
| | | legacy({ |
| | | targets: ['defaults', 'ie >= 11', 'chrome < 60','firefox < 59'], //需要兼容的目标列表,可以设置多个 |
| | | additionalLegacyPolyfills: ['regenerator-runtime/runtime'], |
| | | renderLegacyChunks: true, |
| | | modernPolyfills:true, |
| | | polyfills: [ |
| | | 'es.symbol', |
| | | 'es.array.filter', |
| | | 'es.promise', |
| | | 'es.promise.finally', |
| | | 'es/map', |
| | | 'es/set', |
| | | 'es.array.for-each', |
| | | 'es.object.define-properties', |
| | | 'es.object.define-property', |
| | | 'es.object.get-own-property-descriptor', |
| | | 'es.object.get-own-property-descriptors', |
| | | 'es.object.keys', |
| | | 'es.object.to-string', |
| | | 'web.dom-collections.for-each', |
| | | 'esnext.global-this', |
| | | 'esnext.string.match-all' |
| | | ] |
| | | // 开发环境兼容 |
| | | esbuild({ |
| | | target: 'chrome64', |
| | | loaders: { |
| | | '.vue': 'js', |
| | | '.ts': 'js' |
| | | } |
| | | }), |
| | | // 兼容低版本浏览器 |
| | | // legacy({ |
| | | // // ie >= 11 |
| | | // targets: ['defaults', 'not IE 11', 'chrome < 60','firefox < 59'], //需要兼容的目标列表,可以设置多个 |
| | | // additionalLegacyPolyfills: ['regenerator-runtime/runtime'], |
| | | // // renderLegacyChunks: true, |
| | | // modernPolyfills:true, |
| | | // polyfills: [ |
| | | // 'es.symbol', |
| | | // 'es.array.filter', |
| | | // 'es.promise', |
| | | // 'es.promise.finally', |
| | | // 'es/map', |
| | | // 'es/set', |
| | | // 'es.array.for-each', |
| | | // 'es.object.define-properties', |
| | | // 'es.object.define-property', |
| | | // 'es.object.get-own-property-descriptor', |
| | | // 'es.object.get-own-property-descriptors', |
| | | // 'es.object.keys', |
| | | // 'es.object.to-string', |
| | | // 'web.dom-collections.for-each', |
| | | // 'esnext.global-this', |
| | | // 'esnext.string.match-all' |
| | | // ] |
| | | // }), |
| | | Components({ |
| | | resolvers: [ |
| | | // 自动注册图标组件 |
| | |
| | | }), |
| | | Icons({ |
| | | autoInstall: true |
| | | }), |
| | | ], |
| | | configureWebpack:config=>{ |
| | | config.entry.app=['babel-polyfill','./src/main.js'] |
| | | }, |
| | | }) |
| | | ] |
| | | // configureWebpack:config=>{ |
| | | // config.entry.app=['babel-polyfill','./src/main.js'] |
| | | // }, |
| | | // transpileDependencies:['*'] |
| | | // chainWebpack: (config) => { |
| | | // config.entry('main').add('babel-polyfill') |
| | | // }, |