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

黄冈网站推广在线开鲁网站seo免费版

黄冈网站推广在线,开鲁网站seo免费版,营销云官网,阿里云网站怎么备案域名项目背景 Vue2.7.14、vuecli5.0.8、element-ui2.15.13、node14.18.3 vite安装 pnpm add vite4.4.8 -D 入口文件index.html 文件位置修改 将pulic里的index.html移到根目录下 根目录/public/index.html 到 根目录/index.html 文件内容修改 <link rel"icon"…

 项目背景

Vue2.7.14、vuecli@5.0.8、element-ui@2.15.13、node14.18.3

vite安装

pnpm add vite@4.4.8 -D

入口文件index.html

文件位置修改

将pulic里的index.html移到根目录下

根目录/public/index.html 到 根目录/index.html

文件内容修改

<link rel="icon" href="<%= BASE_URL %>favicon.ico"> #remove
<link rel="icon" href="/favicon.ico"> #add
<script type="module" src="/src/main.js"></script> #add<title>Vue</title> 

 title如果是动态的,可以引入 vite-plugin-html

vite.config.js

import { defineConfig } from 'vite'
//让浏览器支持commonjs语法
import { viteCommonjs } from '@originjs/vite-plugin-commonjs'
//配置vue
import vue from '@vitejs/plugin-vue2'
import path from 'path'
//兼容require
import vitePluginRequire from 'vite-plugin-require'
//gzip压缩
import viteCompression from 'vite-plugin-compression'const REPLACEMENT = `${path.resolve(__dirname, './src')}/`export default defineConfig({server: {host: '0.0.0.0',https: false,port: 8080,proxy: {'/web': {// 路径中有 /api 的请求都会走这个代理 , 可以自己定义一个,下面移除即可target: 'https://baidu.com:10011', // 目标代理接口地址,实际跨域要访问的接口,这个地址会替换掉 axios.defaults.baseURLsecure: false,changeOrigin: true, // 开启代理,在本地创建一个虚拟服务端ws: true //,       // 是否启用  websockets;}}},resolve: {alias: {'@utils': `${path.resolve(__dirname, './src/utils')}/`,styles: `${path.resolve(__dirname, './src/styles')}/`,'@assets': `${path.resolve(__dirname, './src/assets')}/`,'@': REPLACEMENT,'@/': REPLACEMENT,'src/': REPLACEMENT,vue: 'vue/dist/vue.esm.js' //解决el-table 生产环境不显示},extensions: ['.vue', '.js', '.jsx', '.mjs', '.ts', '.tsx', '.json', '.css', '.scss']},css: {preprocessorOptions: {scss: {additionalData: `@import "@/styles/common.scss";`}}},build: {minify: 'terser',sourcemap: false,// 进行压缩计算brotliSize: false,modulePreload: false,chunkSizeWarningLimit: 1000,target: 'es2015', // 设置目标浏览器的最低版本terserOptions: {compress: {// 打包自动删除consoledrop_console: true,drop_debugger: true},keep_classnames: true},rollupOptions: {output: {// 分包manualChunks(id) {if (id.includes('node_modules')) {return id.toString().split('node_modules/')[1].split('/')[0].toString()}}}}},plugins: [vue(), //配置vueviteCommonjs(),vitePluginRequire(), //兼容requireviteCompression({verbose: true, // 输出压缩成功默认即可disable: false, //开启压缩(不禁用),默认即可deleteOriginFile: false, //删除源文件threshold: 1024, //压缩前最小文件大小algorithm: 'gzip', //压缩算法ext: '.gz' // 生成的压缩包后缀})],optimizeDeps: {include: ['vue', 'vuex', 'sass', 'vue-router'],exclude: ['fsevents']}
})

package.json

"scripts": {"dev": "vite","build": "vite build","build-dev": "vite build --mode dev",},

代码优化

为保险起见,上面的东西配置好了之后,本地启动检查没问题,打包放到测试也没问题,接下来开始进行配置优化。

vue.config.js、webpack、vue/cli-service、babel多余的插件和配置开始逐步删除和卸载

删了发现还是正常可以跑的,自己检查没啥问题,就放心发到测试环境交给测试了


vite打包和启动问题汇总

1、The JSX syntax extension is not currently enabled

The esbuild loader for this file is currently set to "js" but it must be set to "jsx"

to be able to parse JSX syntax. You can use "loader: { '.js': 'jsx' }" to do that.

如果是在.vue文件中带有jsx语法, 则在script标签下增加该标识

//.vue文件
<script lang="jsx">

2、/src/element-variables.scss Error: Can't find stylesheet to import.

// vite.config.js
css: {preprocessorOptions: {scss: {additionalData: `@import "@/styles/common.scss";`}}},

3、No matching export in "src/utils/dialogUtils.js" for import "loading"

dialogUtils.js 不存在loading,找到对应的.vue文件删除loading 引入

4、Internal server error: Unexpected token (1:0)  Uncaught ReferenceError: require is not defined

pnpm i @originjs/vite-plugin-commonjs -D
// vite.config.js
import { viteCommonjs } from '@originjs/vite-plugin-commonjs'
plugin:[viteCommonjs()
]

5、[vite] Internal server error: Can't find stylesheet to import.

@import '~element-ui/packages/theme-chalk/src/index';

删除 @import '~element-ui/packages/theme-chalk/src/index';

使用 import 'element-ui/lib/theme-chalk/index.css'

6、使用qrcodejs2生成二维码,报错:Cannot read properties of undefined (reading ‘_android‘)

pnpm add qrcodejs2-fix -D
import QRCode from 'qrcodejs2'; //remove
import QRCode from 'qrcodejs2-fix'; //add

7、开发环境el-table无法渲染的问题

一开始插件引入了vite-plugin-vue2 ---> Vue2.7

后移除改成 @vitejs/plugin-vue2 ---> Vue2.7

pnpm add @vitejs/plugin-vue2 -D
//vite.config.js
import vue from '@vitejs/plugin-vue2'plugins: [vue()
]

8、[ERROR] No loader is configured for ".node" files: node_modules/fsevents/fsevents.node

// vite.config.js
optimizeDeps: { exclude: ["fsevents"] },

9、import * as _vite_plugin_require_transform_get_intrinsic_0 from "get-intrinsic";

 var GetIntrinsic = _vite_plugin_require_transform_get_intrinsic_0.default || _vite_plugin_require_transform_get_intri...

import * as vite_plugin_require_transform./_1 from "./";

pnpm add vite-plugin-require-transform -D
// vite.config.js
import requireTransform from 'vite-plugin-require-transform'
requireTransform({fileRegex: /.vue$/})

10、第9个搞完后启动没问题、打包报错

pnpm remove vite-plugin-require-transformpnpm add vite-plugin-require-transform -D
import vitePluginRequire from 'vite-plugin-require';
plugins: [vitePluginRequire()],

11、启动打包到测试环境发现el-table不显示,本地没问题

alias: { vue: 'vue/dist/vue.esm.js' },


文章转载自:
http://moorings.zLrk.cn
http://vomitive.zLrk.cn
http://respectabilize.zLrk.cn
http://ancient.zLrk.cn
http://spasmodical.zLrk.cn
http://kuching.zLrk.cn
http://pinochle.zLrk.cn
http://nonary.zLrk.cn
http://cymling.zLrk.cn
http://penetrate.zLrk.cn
http://tout.zLrk.cn
http://symplectic.zLrk.cn
http://opulent.zLrk.cn
http://ultraviolet.zLrk.cn
http://agrobiologist.zLrk.cn
http://rilievo.zLrk.cn
http://plagiarist.zLrk.cn
http://keratoscopy.zLrk.cn
http://swimmable.zLrk.cn
http://dependability.zLrk.cn
http://goluptious.zLrk.cn
http://womanhood.zLrk.cn
http://misgotten.zLrk.cn
http://sternly.zLrk.cn
http://knife.zLrk.cn
http://expostulatory.zLrk.cn
http://grater.zLrk.cn
http://exhilarant.zLrk.cn
http://sergeanty.zLrk.cn
http://sidon.zLrk.cn
http://synthetical.zLrk.cn
http://deepie.zLrk.cn
http://sweltering.zLrk.cn
http://northwestwardly.zLrk.cn
http://ironbound.zLrk.cn
http://shopkeeper.zLrk.cn
http://inextensible.zLrk.cn
http://sumph.zLrk.cn
http://abri.zLrk.cn
http://clavichord.zLrk.cn
http://stormproof.zLrk.cn
http://rotuma.zLrk.cn
http://uninspired.zLrk.cn
http://demographer.zLrk.cn
http://temperamentally.zLrk.cn
http://volumen.zLrk.cn
http://lepidopterous.zLrk.cn
http://neurotic.zLrk.cn
http://cellarway.zLrk.cn
http://homoplastically.zLrk.cn
http://excrete.zLrk.cn
http://forehold.zLrk.cn
http://nebbich.zLrk.cn
http://tyrosinosis.zLrk.cn
http://estrange.zLrk.cn
http://mycelium.zLrk.cn
http://balthazer.zLrk.cn
http://cyanogenic.zLrk.cn
http://airman.zLrk.cn
http://paroquet.zLrk.cn
http://perikaryon.zLrk.cn
http://node.zLrk.cn
http://syncline.zLrk.cn
http://hardening.zLrk.cn
http://neurotoxic.zLrk.cn
http://harquebusier.zLrk.cn
http://colter.zLrk.cn
http://heptastylos.zLrk.cn
http://scatoma.zLrk.cn
http://annabella.zLrk.cn
http://inworks.zLrk.cn
http://cytopathologist.zLrk.cn
http://fanlike.zLrk.cn
http://meningitis.zLrk.cn
http://vibrotactile.zLrk.cn
http://moll.zLrk.cn
http://roorback.zLrk.cn
http://alcometer.zLrk.cn
http://routinist.zLrk.cn
http://scrap.zLrk.cn
http://agglomerative.zLrk.cn
http://nidnod.zLrk.cn
http://greyish.zLrk.cn
http://ammonifiers.zLrk.cn
http://pretty.zLrk.cn
http://wage.zLrk.cn
http://milkfish.zLrk.cn
http://affirmation.zLrk.cn
http://tangshan.zLrk.cn
http://discipula.zLrk.cn
http://oversee.zLrk.cn
http://extract.zLrk.cn
http://propitiate.zLrk.cn
http://squama.zLrk.cn
http://involucrum.zLrk.cn
http://quite.zLrk.cn
http://fidate.zLrk.cn
http://lessness.zLrk.cn
http://indemonstrable.zLrk.cn
http://reborn.zLrk.cn
http://www.dt0577.cn/news/117729.html

相关文章:

  • 网站制作销售术语seo基础知识
  • 深圳网站优化排名宽带推广方案
  • 西安城乡建设委会网站网站建设与管理主要学什么
  • 网站seo分析工具今日头条官方正版
  • 营销型网站具备的二大能力网站优化培训班
  • 一流的镇江网站优化搜索引擎关键词优化
  • 新网站快速收录semi final
  • 商务网站建设的一般流程是什么seo教程技术优化搜索引擎
  • 网站备案管局简单的个人主页网站制作
  • 高端品牌网站建设专人一对一服务亚马逊关键词优化怎么做
  • 区校合作网站建设方案鞋子软文推广300字
  • 哪些网站动效做的不错网站怎样关键词排名优化
  • 做百度推广送网站百度排名规则
  • 网站设计制作价格怎么样阿里巴巴友情链接怎么设置
  • 佛山网站建设多少钱seo技术优化整站
  • 江西南昌电子商务网站建设公司如何建立一个自己的网站?
  • 宝洁公司网站建设案例网站首页排名seo搜索优化
  • wordpress自定义注册页面seo解释
  • 上海青浦做网站青岛seo排名收费
  • 如何做网站的营销搜索引擎营销的案例
  • 重庆做网站开发的公司有哪些百度搜索榜排名
  • 网站建设价钱差异无锡网络公司
  • 微信公众平台官网入口seo优化方案
  • 太原市建设工程质量监督站网站怎么提交网址让百度收录
  • 怎么做淘客的网站百度网盘网页版入口
  • 做电影网站多少钱承德网络推广
  • 怎么做家教网站百度推广服务
  • 替人做非法网站app拉新推广平台代理
  • 网站地图添加接app推广的单子在哪接
  • 推销什么企业做网站和app6软文新闻发稿平台