1、找到/build/webpack.dev.conf.js新增配置,运行项目用到
```js
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'index.html',
node_env_dev: true, // 新增配置
inject: true,
favicon: path.resolve('./static/favicon.ico')
}),
```
2、找到/build/webpack.prod.conf.js新增配置,打包项目用到
```js
new HtmlWebpackPlugin({
filename: config.build.index,
template: 'index.html',
inject: true,
node_env_prod: true, // 新增配置
version_time: new Date().getTime(), // 配置打包后config.js文件,加时间戳
...
}),
new CopyWebpackPlugin([
{
from: path.resolve(__dirname, '../static'),
to: config.build.assetsSubDirectory,
ignore: ['.*','config.js'] // 忽略掉 config.js 文件的复制
},
// 复制配置文件到根路径下
{
from: path.join(__dirname,'../static/config.js')
}
])
```
3、找到需要配置的页面index.html
//判断运行配置文件的引用路径,使打包后正常引用。
```?v=<%=htmlWebpackPlugin.options.version_time%>``` 对引入文件加时间戳
```html
<% if ( htmlWebpackPlugin.options.node_env_prod ) { %> <% } %>
<% if ( htmlWebpackPlugin.options.node_env_dev ) { %> <% } %>
```
运行vue函数提示将“vue”项识别为 cmdlet、函数、脚本文件或可运行程序的名称解决方法
上面是“vuejs实现全站可配置”的全面内容,想了解更多关于 vuejs 内容,请继续关注web建站教程。
当前网址:https://ipkd.cn/webs_1634.html
workflows工作流
梦幻向日葵ComfyUI工作流
一只猫捧着一条鱼ComfyUI工作流
ai图片扩大comfyui工作流
树上挂着一只表情可爱的香蕉ComfyUI工作流二
一个男人正走进科幻的大门ComfyUI工作流
一个戴着破旧莎草帽的机械忍者
迷人的月光,发光的花朵
文生图工作流:一幅海底睡莲,碧海蓝天comfyui工
猜你喜欢
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

css3做一个风雨雷电天气动态图标
css3结合svg做一个动态广告
利用CSS3做一个星级评分样式
canvas空间文本射线
数字滚动效果(兼容IE6/IE8)
纯html+css做一个3d统计效果
html5如何3D立方体旋转特效
纯css制作卡通头像(随鼠标转头)











