NorthwoodsSoftware / GoJS

JavaScript diagramming library for interactive flowcharts, org charts, design tools, planning tools, visual languages.
http://gojs.net
Other
7.8k stars 2.86k forks source link

2.2.3 added breaking change for default export #170

Closed JingzheSun closed 2 years ago

JingzheSun commented 2 years ago

previous versions allow using default export e.g import go from "gojs" but the newly added "module": "release/go-module.js" only works with named export import * as go from "gojs".

It is expected that both import types are supported among the same minor version. upgrading from 2.2.2 to 2.2.3 should not bring any other issue.

simonsarris commented 2 years ago

Thank you for pointing this out. We'll revert the package.json line.

simonsarris commented 2 years ago

If instead of reverting the package.json, if we modified go-module.js to include a default:

export default (typeof global !== "undefined") ? global.go : self.go;
export const go = (typeof global !== "undefined") ? global.go : self.go;

Instead of what it is right now:

export const go = (typeof global !== "undefined") ? global.go : self.go;

Would that work for you? We want to make sure this is proper for module users. Such a change would support any of these:

import go from "gojs";
import * as go from "gojs";
import { go } from "gojs";
simonsarris commented 2 years ago

We have just released 2.2.5, which should fix this. Please let me know if you continue to have issues.