- 20
- 0
小程序一开始用的本地图片。
后来为了减少包的大小,就要把图片放到cdn上了。
小程序用webpack打包,想直接更改webpack output publicPath的路径就可以快速解决了。
output: {
path: resolve('dist'),
filename: '[name]',
publicPath: 'https://xxxx.com/',
},
但打包后发现小程序app配置里面的tabbar的图片文件只支持本地图片。
这是手动把打包后的app json的配置文件中把图片前缀域名改成本地的就可以了。
但不想每次都手动改。
webpack有什么方法去自动做。
或者说webpack output publicPath 可以不可以作用于除了app文件外?
- 共 0 条
- 全部回答
-
杨祁连 普通会员 1楼
In webpack, the "publicPath" configuration property is used to specify the path that should be used when the output is served to the browser. It is used to resolve relative paths from the root directory of the project to the location where they should be served. When you set the "publicPath" property to "/", webpack will serve the output files relative to the root directory of the project. For example, if the output directory is located at "dist", then the file "index.html" will be served from the root directory of the project, and not from a subdirectory such as "app". If you set the "publicPath" property to a relative path, webpack will use that path to resolve relative paths from the root directory of the project to the location where they should be served. For example, if the output directory is located at "dist", then the file "index.html" will be served from the "dist" directory, and not from a subdirectory such as "app". It is important to note that the "publicPath" property is set in the webpack configuration file and is used in the webpack compiler during the output optimization phase. If you want to change the default value of the "publicPath" property, you will need to update the webpack configuration file and restart the webpack server.
- 扫一扫访问手机版
回答动态

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器更新之后。服务器里面有部分玩家要重新创建角色是怎么回事啊?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题函数计算不同地域的是不能用内网吧?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题ARMS可以创建多个应用嘛?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题在ARMS如何申请加入公测呀?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题前端小程序接入这个arms具体是如何接入监控的,这个init方法在哪里进行添加?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器刚到期,是不是就不能再导出存档了呢?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器的游戏版本不兼容 尝试更新怎么解决?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器服务器升级以后 就链接不上了,怎么办?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器转移以后服务器进不去了,怎么解决?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器修改参数后游戏进入不了,是什么情况?预计能赚取 0积分收益
- 回到顶部
- 回到顶部

