Code Monkey home page Code Monkey logo

Comments (6)

GRCmade avatar GRCmade commented on July 20, 2024

暂时没有复现,你可以说的详细一点吗,比如具体是哪个页面访问分包图片之类的

from uni-app.

xiaohe0601 avatar xiaohe0601 commented on July 20, 2024

uni-preset-vue-vite-ts.zip

@GRCmade /packages/pkg-a/index 页面,H5访问会报错,微信小程序正常

from uni-app.

xiaohe0601 avatar xiaohe0601 commented on July 20, 2024

经测试,从 3.0.0-alpha-4020120240617001 开始,微信小程序端编译时也会报错

[vite]: Rollup failed to resolve import "/packages/pkg-a/static/image.png" from "***/uni-preset-vue-vite-ts/src/packages/pkg-a/index.vue".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`

from uni-app.

GRCmade avatar GRCmade commented on July 20, 2024

图片的路径加一个@就好了
image

from uni-app.

xiaohe0601 avatar xiaohe0601 commented on July 20, 2024

@GRCmade 直接使用 image 组件没有问题,如果是自定义组件请问应该怎么处理呢

src/components/AppImage.vue

<template>
  <image :src="props.src"></image>
</template>

<script setup lang="ts">
const props = defineProps<{
  src: string;
}>()
</script>

src/packages/pkg-a/index.vue

<template>
  <view class="content">
    <!-- 无法正常显示 -->
    <app-image src="@/packages/pkg-a/static/image.png"></app-image>

    <!-- 可以正常显示 -->
    <image src="@/packages/pkg-a/static/image.png"></image>
  </view>
</template>

<script setup lang="ts">
import AppImage from "@/components/AppImage.vue";
</script>

from uni-app.

xiaohe0601 avatar xiaohe0601 commented on July 20, 2024

@GRCmade 你好,请问有解决方案吗?🤔

from uni-app.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.