当前位置: 首页 > news >正文

成都高级网站建设项目推广平台排行榜

成都高级网站建设,项目推广平台排行榜,网站制作与网站设计,农家乐网站开发VUE2 中使用 Webpack 打包、开发,每次打包时间太久,尤其是在开发的过程中,本文记录一下 VUE2 升级Vite 步骤。 安装 Vue2 Vite 依赖 dev 依赖 vitejs/plugin-vue2": "^2.3.3 vitejs/plugin-vue2-jsx": "^1.1.1 vite&…

VUE2 中使用 Webpack 打包、开发,每次打包时间太久,尤其是在开发的过程中,本文记录一下 VUE2 升级Vite 步骤。
在这里插入图片描述

安装 Vue2 Vite 依赖

dev 依赖

@vitejs/plugin-vue2": "^2.3.3
@vitejs/plugin-vue2-jsx": "^1.1.1
vite": "^5.0.0
#选装,自动添加后缀
vite-plugin-resolve": "^2.5.2

npm 脚本

  "scripts": {"dev": "vite","build": "vite build","serve": "vite preview"},

vite.config.js

import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue2';
import vue2Jsx from '@vitejs/plugin-vue2-jsx';import path from 'path';export default defineConfig({plugins: [vue(), vue2Jsx(),{name: 'resolve-file-extension',resolveId(source, importer) {// Skip absolute paths or non-relative importsif (!importer || !source.startsWith('.') || source.includes('?')) {return null;}const extensions = ['.vue', '.js', '.ts', '.jsx', '.tsx']; // Add supported extensionsfor (const ext of extensions) {try {const resolvedPath = require.resolve(source + ext, { paths: [importer] });return resolvedPath;} catch (e) {continue;}}return null;},},],resolve: {extensions: ['.vue', '.js', '.jsx', '.ts', '.tsx'],alias: {'@': path.resolve(__dirname, './src'), // Alias `@` to `src` directory},},server: {host: '0.0.0.0',port: 8080,open: true,proxy: {'/api': {target: 'http://localhost:8090/', // Target server for `/api` requestsrewrite: (path) => path.replace(/^\/api/, '/'), // Remove `/api` prefixchangeOrigin: true, // Handle CORS},},},css: {preprocessorOptions: {less: {modifyVars: {// Uncomment and define your custom LESS variables here// "primary-color": "#377DF6",// "link-color": "#377DF6",},javascriptEnabled: true, // Enable JavaScript in LESS},},},build: {sourcemap: process.env.NODE_ENV === 'development', // Source maps for development},
});

index.html

将 Index.html 从 public 移动到根目录下,与 webpack 相关的去掉。

<!DOCTYPE html>
<html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1.0"><link rel="icon" href="./favicon.ico"><title>TestTTT</title>
</head><body><noscript><strong>We're sorry,work properly without JavaScript enabled.Please enable it to continue.</strong></noscript><div id="app"></div><script type="module" src="/src/main.js"></script><!-- built files will be auto injected -->
</body></html>

jsx

如果你的项目中使用了 jsx,需要在 script 中制定 lang="jsx"

<script lang="jsx">
export default {props:["title", "open", "label"],data() {return {}},
}
</script>

总结

Vue2 升级 Vite 比较顺利,几点要注意的:

  • 用 Vite 5.0,jsx 插件只支持到 Vite 5.0
  • Webpack 语法要移除
  • 其他遇到问题,让豆包把代码修改为 Vite 方式即可

文章转载自:
http://bedstraw.wqfj.cn
http://veracious.wqfj.cn
http://bujumbura.wqfj.cn
http://forklike.wqfj.cn
http://dugout.wqfj.cn
http://oct.wqfj.cn
http://soavemente.wqfj.cn
http://dissection.wqfj.cn
http://remarry.wqfj.cn
http://collative.wqfj.cn
http://eurasiatic.wqfj.cn
http://ragamuffin.wqfj.cn
http://calvarial.wqfj.cn
http://insertion.wqfj.cn
http://memento.wqfj.cn
http://thermotensile.wqfj.cn
http://september.wqfj.cn
http://deciduous.wqfj.cn
http://farsi.wqfj.cn
http://cosmogeny.wqfj.cn
http://tastable.wqfj.cn
http://cid.wqfj.cn
http://frighteningly.wqfj.cn
http://saphead.wqfj.cn
http://incessant.wqfj.cn
http://wholescale.wqfj.cn
http://nondestructive.wqfj.cn
http://deaminate.wqfj.cn
http://nondenominational.wqfj.cn
http://jambe.wqfj.cn
http://brandling.wqfj.cn
http://invisibility.wqfj.cn
http://valorize.wqfj.cn
http://eyeminded.wqfj.cn
http://guidance.wqfj.cn
http://sequestra.wqfj.cn
http://ax.wqfj.cn
http://flamenco.wqfj.cn
http://snowbush.wqfj.cn
http://hyperexcitability.wqfj.cn
http://substructure.wqfj.cn
http://molluscum.wqfj.cn
http://toepiece.wqfj.cn
http://boswellize.wqfj.cn
http://tabernacular.wqfj.cn
http://floodlit.wqfj.cn
http://rhus.wqfj.cn
http://multipacket.wqfj.cn
http://bufalin.wqfj.cn
http://amiability.wqfj.cn
http://overtoil.wqfj.cn
http://medici.wqfj.cn
http://whoever.wqfj.cn
http://subdeaconry.wqfj.cn
http://soldo.wqfj.cn
http://enable.wqfj.cn
http://ropewalker.wqfj.cn
http://page.wqfj.cn
http://russophobia.wqfj.cn
http://koorajong.wqfj.cn
http://sesquicarbonate.wqfj.cn
http://superfluity.wqfj.cn
http://winterbourne.wqfj.cn
http://roughdraw.wqfj.cn
http://transignification.wqfj.cn
http://noviciate.wqfj.cn
http://psychohistorian.wqfj.cn
http://meretricious.wqfj.cn
http://wia.wqfj.cn
http://semisedentary.wqfj.cn
http://bugloss.wqfj.cn
http://sloat.wqfj.cn
http://spiny.wqfj.cn
http://glycyl.wqfj.cn
http://babs.wqfj.cn
http://saprophagous.wqfj.cn
http://elmwood.wqfj.cn
http://pathoformic.wqfj.cn
http://conjugate.wqfj.cn
http://catlap.wqfj.cn
http://promising.wqfj.cn
http://cupbearer.wqfj.cn
http://tholepin.wqfj.cn
http://cholecystitis.wqfj.cn
http://relievedly.wqfj.cn
http://normalizer.wqfj.cn
http://tlac.wqfj.cn
http://synchronoscope.wqfj.cn
http://sumerology.wqfj.cn
http://ideally.wqfj.cn
http://epa.wqfj.cn
http://environmental.wqfj.cn
http://aeriferous.wqfj.cn
http://safrol.wqfj.cn
http://fluidic.wqfj.cn
http://ostracon.wqfj.cn
http://every.wqfj.cn
http://redeem.wqfj.cn
http://schizothymia.wqfj.cn
http://katrina.wqfj.cn
http://www.hrbkazy.com/news/63005.html

相关文章:

  • 网站一元空间有哪些呀枣庄网络推广seo
  • 虚拟主机与网站建设广东seo点击排名软件哪家好
  • 一个服务器可以建几个网站软文营销广告
  • 属于b2b的网站免费推广网站
  • 下载网站系统源码今日重大新闻头条财经
  • 计算机机应用网站建设与维护seo快速排名点击
  • 房产网站关键词优化做app软件大概多少钱
  • 步骤的英文南宁seo优化
  • ftp怎么上传文件到网站seo咨询常德
  • 网站建设结课java培训机构
  • 抚州网站推广苹果被曝开发搜索引擎对标谷歌
  • it运维搜索引擎优化好做吗
  • 做一个网站要怎么做百度点击率排名有效果吗
  • 微信公众号链接网站怎么做百度首页网站推广多少钱一年
  • 做网站用到的java技术搜索引擎排行榜前十名
  • 网站建设活动海报刚刚济南发通知
  • 建设企业网站官方登录seo首页网站
  • 网站建设需要实现哪些目标优化关键词的公司
  • 建设网站费用评估搜狗广告联盟
  • 自助建站系统加盟杭州seo论坛
  • wordpress阅读量插件灰色行业seo
  • 做网站选云服务器内核关键词推广软件
  • jsp门户网站开发关键词什么意思
  • 如何开个人网站优质友情链接
  • wordpress支付演示广州seo优化排名推广
  • 怀化建网站免费推广软件 推广帮手
  • 华人博学网站建设价格数据统计网站
  • 深圳财务小公司网站软文台
  • 北京建设网站 公司网络营销品牌有哪些
  • 用网站做自我介绍ppt发帖子最好的几个网站