Coder Social home page Coder Social logo

Comments (6)

howel52 avatar howel52 commented on May 21, 2024

src 需要走 hostname + port 的绝对地址,需要改动一下 publicPath

这是由于你的 CRA 项目启在 xxx1 端口下,而 master 项目启在 xxx2 端口,在 master 里通过相对路径加载资源会导致端口号错误的问题

from qiankun.

kuitos avatar kuitos commented on May 21, 2024

楼上正解,开发阶段需要配置一下 publicPath: hostname + port
推荐基于 umi-plugin-qiankun 来搭建应用可以少很多配置阶段的麻烦

from qiankun.

kuitos avatar kuitos commented on May 21, 2024

see https://github.com/umijs/qiankun/wiki/FAQ#why-dynamic-imported-assets-missing

from qiankun.

gaorubin1990 avatar gaorubin1990 commented on May 21, 2024

@kuitos 子应用用的一个,并且设置了__webpack_public_path__ = window.INJECTED_PUBLIC_PATH_BY_QIANKUN。用简单的webpack+react搭建的主应用没问题,umi搭建的主应用有子应用图片加载不出来。状态码200,preview是空的

from qiankun.

keunone avatar keunone commented on May 21, 2024

@kuitos 请问,子应用已经设置了__webpack_public_path__ = window.INJECTED_PUBLIC_PATH_BY_QIANKUN;而且在webpack中配置了publicPath,但是主应用加载的子应用依然不能正确显示cdn图片路径,如下图,请问你什么思考方向吗?
子应用入口文件:
入口文件

子应用webpack配置:
webpack

主应用中子应用加载图片路径:
路径显示

from qiankun.

sansecao avatar sansecao commented on May 21, 2024

@keunone请问问题解决了吗,我也遇到了相同的问题

from qiankun.

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.