We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
问题描述 请用简洁的语言描述你遇到的bug,至少包括以下部分,如提供截图请尽量完整:
defs: { __mpx_domain__: process.env.DOMAIN }
期望的表现 mpx_domain 值在使用的时候是期望的值。
实际的表现 DOMAIN 环境变量一开始是 A,再改为 B 以后,build 结果生成的文件中就会即有 A 又有 B。
环境信息描述 至少包含以下部分:
"dependencies": { "@mpxjs/api-proxy": "^2.9.0", "@mpxjs/core": "^2.9.0", "@mpxjs/fetch": "^2.9.0", "@mpxjs/pinia": "^2.9.0", "@mpxjs/store": "^2.9.0", "@mpxjs/utils": "^2.9.0", "pinia": "^2.0.14", "vue": "^2.7.0", "vue-demi": "^0.14.6", "vue-i18n": "^8.27.2", "vue-i18n-bridge": "^9.2.2", "vue-router": "^3.1.3" }, "devDependencies": { "@babel/core": "^7.10.4", "@babel/plugin-transform-runtime": "^7.10.4", "@babel/preset-env": "^7.10.4", "@babel/runtime-corejs3": "^7.10.4", "@mpxjs/babel-plugin-inject-page-events": "^2.9.0", "@mpxjs/eslint-config": "^1.0.5", "@mpxjs/mpx-cli-service": "^2.0.0", "@mpxjs/size-report": "^2.9.0", "@mpxjs/vue-cli-plugin-mpx": "^2.0.0", "@mpxjs/vue-cli-plugin-mpx-eslint": "^2.0.0", "@mpxjs/webpack-plugin": "^2.9.0", "@vue/cli-service": "~5.0.0", "autoprefixer": "^10.2.4", "eslint": "^7.0.0", "postcss": "^8.2.6", "stylus": "^0.55.0", "stylus-loader": "^6.1.0", "webpack": "^5.43.0" },
最简复现demo view 代码部分
<view wx:for="{{listData}}" wx:for-index="index" wx:key="*this" wx:for-item="item" class="section" > <view class="title">{{ item.title }}</view> <view class="card" wx:for="{{item.items}}" wx:for-index="subIndex" wx:key="*this" wx:for-item="subItem" > <view> <image src="{{__mpx_domain__}}{{subItem.images}}.avif" mode="aspectFit" lazy-load="{{true}}" bindtap="previewImageTap(subItem.images)" ></image ></view> <view class="sub-title">{{ subItem.subTitle }}</view> </view> </view>
script 代码部分
<script> import mpx, { createComponent } from '@mpxjs/core' import { data } from '../lib/store' createComponent({ data: { listData: data }, methods: { previewImageTap(url) { /* eslint-disable camelcase */ console.log(__mpx_domain__ + url) mpx.previewImage({ /* eslint-disable camelcase */ urls: [__mpx_domain__ + url] }) } } }) </script>
删除 .cache 和 dist 以后重新 build 就好了。
The text was updated successfully, but these errors were encountered:
这个defs是在哪个文件中定义的? 是vue.config.js中吗?
Sorry, something went wrong.
@hiyuki 是的。
mpx: { plugin: { // mode: 'web', srcMode: 'wx', hackResolveBuildDependencies: ({ files, resolveDependencies }) => { const path = require('path') const packageJSONPath = path.resolve('package.json') if (files.has(packageJSONPath)) files.delete(packageJSONPath) if (resolveDependencies.files.has(packageJSONPath)) { resolveDependencies.files.delete(packageJSONPath) } }, defs: { __mpx_domain__: process.env.DOMAIN } }, loader: {} }
No branches or pull requests
问题描述
请用简洁的语言描述你遇到的bug,至少包括以下部分,如提供截图请尽量完整:
进行自定义 defs 变量
期望的表现
mpx_domain 值在使用的时候是期望的值。
实际的表现
DOMAIN 环境变量一开始是 A,再改为 B 以后,build 结果生成的文件中就会即有 A 又有 B。
环境信息描述
至少包含以下部分:
最简复现demo
view 代码部分
script 代码部分
删除 .cache 和 dist 以后重新 build 就好了。
The text was updated successfully, but these errors were encountered: