GitBucket
4.6.0
Toggle navigation
Sign in
Files
Branches
1
Tags
Issues
Pull Requests
Labels
Milestones
Wiki
08335
/
hivui-platform-template
hivui平台项目模板
Browse code
add
master
1 parent
597deab
commit
d0ebc61ed02c6983b0a5d7f5b2d220e7b53a88cd
caibinghong
authored
on 4 Jun 2021
Showing
1 changed file
vite.config.js
Ignore Space
Show notes
View
vite.config.js
/* //eg: export default ({ mode }) => { process.env = { ...process.env, ...loadEnv(mode, process.cwd()) }; // import.meta.env.VITE_NAME available here with: process.env.VITE_NAME // import.meta.env.VITE_PORT available here with: process.env.VITE_PORT const plugins = mode === 'development' ? [reactRefresh()] : []; return defineConfig({ plugins, publicDir: 'src/assets', resolve: { alias: aliases, }, build: { chunkSizeWarningLimit: 1500, }, }); }; */ // vite.config.js 利害浏览器自带的 es 动态导入,使项目冷启动 const { resolve } = require('path'); import { defineConfig, loadEnv } from 'vite' // import vue from '@vitejs/plugin-vue' //(1) import { createVuePlugin } from "vite-plugin-vue2"; import vueJsx from '@vitejs/plugin-vue-jsx' const pageage = require("./package.json"); // https://vitejs.dev/config/ export default ({ mode }) => { process.env = { ...process.env, ...loadEnv(mode, process.cwd()) }; let aliases = {} let build = { sourcemap: false, //编译 //指定 多个 .html 文件作为入口点 rollupOptions: { // 请确保外部化那些你的库中不需要的依赖 // external: ['vue'], input: { main: resolve(__dirname, 'index.html'), nested: resolve(__dirname, 'nested/index.html') }, output: { format: 'umd', } } } if (mode == 'development') { aliases = { '@main': resolve(`${pageage.name == 'hi-vui-template' ? 'project' : pageage.name}/hivuiMain`), } console.log('aliases@main:', aliases['@main']); } else { } return defineConfig({ build: build, css: { preprocessorOptions: { less: { javascriptEnabled: true, } }, }, resolve: { extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue', '.dtvevt', '.dtv'], alias: aliases, }, plugins: [ createVuePlugin(), vueJsx({ // options are passed on to @vue/babel-plugin-jsx }) ], optimizeDeps: { // exclude:["hi-ui"],//冷启动时,排除的包 }, devServer: { port: 227, proxy: 'http://192.168.1.183:5001/' } }) };
/* //eg: export default ({ mode }) => { process.env = { ...process.env, ...loadEnv(mode, process.cwd()) }; // import.meta.env.VITE_NAME available here with: process.env.VITE_NAME // import.meta.env.VITE_PORT available here with: process.env.VITE_PORT const plugins = mode === 'development' ? [reactRefresh()] : []; return defineConfig({ plugins, publicDir: 'src/assets', resolve: { alias: aliases, }, build: { chunkSizeWarningLimit: 1500, }, }); }; */ // vite.config.js 利害浏览器自带的 es 动态导入,使项目冷启动 const { resolve } = require('path'); import { defineConfig, loadEnv } from 'vite' // import vue from '@vitejs/plugin-vue' //(1) import { createVuePlugin } from "vite-plugin-vue2"; import vueJsx from '@vitejs/plugin-vue-jsx' const pageage = require("./package.json"); let build = { sourcemap: false, //编译 //指定 多个 .html 文件作为入口点 rollupOptions: { // 请确保外部化那些你的库中不需要的依赖 // external: ['vue'], input: { main: resolve(__dirname, 'index.html'), nested: resolve(__dirname, 'nested/index.html') }, output: { format: 'umd', } } } // https://vitejs.dev/config/ export default ({ mode }) => { process.env = { ...process.env, ...loadEnv(mode, process.cwd()) }; let aliases={} if(mode == 'development'){ aliases= { '@main': resolve(`${pageage.name=='hi-vui-template'?'project':pageage.name}/hivuiMain`), } console.log('aliases@main:', aliases['@main']); }else{ } return defineConfig({ build: build, css: { preprocessorOptions: { less: { javascriptEnabled: true, } }, }, resolve: { extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue', '.dtvevt', '.dtv'], alias:aliases, }, plugins: [ createVuePlugin(), vueJsx({ // options are passed on to @vue/babel-plugin-jsx }) ], optimizeDeps: { // exclude:["hi-ui"],//冷启动时,排除的包 }, devServer: { port: 227, proxy: 'http://192.168.1.183:5001/' } }) };
Show line notes below