Skip to content
This repository has been archived by the owner on Mar 31, 2021. It is now read-only.

npm package (latest version 4.2.0) factory method mxBasePath param not working #479

Closed
hungtcs opened this issue Aug 13, 2020 · 11 comments
Closed

Comments

@hungtcs
Copy link

hungtcs commented Aug 13, 2020

the follow code to load mxgraph, but mxBasePath not working:

import factory from 'mxgraph';
const mx = factory({
      mxBasePath: 'assets',
});

image

if set window.mxBasePath = 'assets' is working well.

this demo can reappear the issues: https://stackblitz.com/edit/js-yjyqmw


version: 4.2.0

@LittleBoBo-beep
Copy link

文件路径在public下开始查找的

@hungtcs
Copy link
Author

hungtcs commented Aug 17, 2020

您好 @LittleBoBo-beep,通过factory配置mxBasePath之后前缀应该生效的,但是这里没有,如果通过window.mxBasePath配置可以生效

@LittleBoBo-beep
Copy link

看报错信息是build文件,你可以把mxgraph静态文件放置到根目录下的public或者static文件下,之后mxBasePath属性值改为./public或者./static即可

@hungtcs
Copy link
Author

hungtcs commented Aug 17, 2020

@LittleBoBo-beep 您好,我的意思是通过factory方法配置mxBasePath不生效

@LittleBoBo-beep
Copy link

import mx from 'mxgraph'
const mxgraph = mx({
mxBasePath: './mxgraph'
})
这是我使用的

@hungtcs
Copy link
Author

hungtcs commented Aug 18, 2020

import mx from 'mxgraph'
const mxgraph = mx({
mxBasePath: './mxgraph'
})
这是我使用的

您那里mxBasePath生效了么?

@LittleBoBo-beep
Copy link

生效了,你的不生效主要是mxGraph的静态资源存放位置不对

@hungtcs
Copy link
Author

hungtcs commented Aug 19, 2020

看报错信息是build文件,你可以把mxgraph静态文件放置到根目录下的public或者static文件下,之后mxBasePath属性值改为./public或者./static即可

mxBasePath就是用来配置资源路径的,你这里放到public或者static下,mxGraph默认就是从根目录下获取资源,所以你这里配不配mxBasePath没什么关系,如果你遇到了和我一样的问题,那么你的mxBasePath这里随便配什么路径都没有影响的,所以还是没生效,

https://stackblitz.com/edit/js-yjyqmw

@LittleBoBo-beep
Copy link

你的静态资源放在什么路径下

@tbouffard
Copy link

tbouffard commented Sep 14, 2020

@hungtcs @LittleBoBo-beep could you please provide a summary of your conversion in english for non-chinese speaking people 😸 ?
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

@hungtcs
Copy link
Author

hungtcs commented Sep 14, 2020

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants