Closed hungtcs closed 3 years ago
文件路径在public下开始查找的
您好 @LittleBoBo-beep,通过factory
配置mxBasePath
之后前缀应该生效的,但是这里没有,如果通过window.mxBasePath
配置可以生效
看报错信息是build文件,你可以把mxgraph静态文件放置到根目录下的public或者static文件下,之后mxBasePath属性值改为./public或者./static即可
@LittleBoBo-beep 您好,我的意思是通过factory方法配置mxBasePath
不生效
import mx from 'mxgraph' const mxgraph = mx({ mxBasePath: './mxgraph' }) 这是我使用的
import mx from 'mxgraph' const mxgraph = mx({ mxBasePath: './mxgraph' }) 这是我使用的
您那里mxBasePath
生效了么?
生效了,你的不生效主要是mxGraph的静态资源存放位置不对
看报错信息是build文件,你可以把mxgraph静态文件放置到根目录下的public或者static文件下,之后mxBasePath属性值改为./public或者./static即可
mxBasePath
就是用来配置资源路径的,你这里放到public
或者static
下,mxGraph默认就是从根目录下获取资源,所以你这里配不配mxBasePath
没什么关系,如果你遇到了和我一样的问题,那么你的mxBasePath
这里随便配什么路径都没有影响的,所以还是没生效,
你的静态资源放在什么路径下
@hungtcs @LittleBoBo-beep could you please provide a summary of your conversion in english for non-chinese speaking people :smile_cat: ? The issue you are describing seems close to #49 This is probably why this commonjs wrapper includes setting globals to the window object as workaround: https://github.com/asual/mxgraph-factory/blob/7dfe46b3d6634c5b6fcc4965be939c6547266409/src/mxgraph-factory.ts
Hi @tbouffard! Sorry for the unintelligible discussion, here are no substantive progress in the above discussion. I have been trying to explain to @LittleBoBo-beep the assets location path is not related to this issues.
the follow code to load mxgraph, but
mxBasePath
not working:if set
window.mxBasePath = 'assets'
is working well.this demo can reappear the issues: https://stackblitz.com/edit/js-yjyqmw
version: 4.2.0