If you want to import these classes to do things like
node.fill instanceof LinearGradient
you have to drop the “Fill” suffix. The class creation functions are indeed called
LinearGradientFill
RadialGradientFill
which is confusing. Perhaps the names exported from scenegraph should be fixed? Or augmented (so it won’t break existing code)?
I console-log’d the results of webpack loading the scenegraph module, and here’s the relevant portion:
RepeatGrid: { [Function: RepeatGrid] super_: [Function: SceneNode] },
SymbolInstance: { [Function: SymbolInstance] super_: [Function: SceneNode] },
LinkedGraphic: { [Function: LinkedGraphic] super_: [Function: SceneNode] },
Matrix: { [Function: Matrix] newFromString: [Function] },
Color: { [Function: Color] deserializeAGC: [Function] },
LinearGradient: [Function: LinearGradientFill],
RadialGradient: [Function: RadialGradientFill],
ImageFill: { [Function: ImageFill] SCALE_COVER: 'cover', SCALE_STRETCH: 'normal' },
Blur: { [Function: Blur] deserializeAGC: [Function] },
Shadow: { [Function: Shadow] deserializeAGC: [Function], deserialize: [Function] },
in which case you can see that only these two module exports don’t match the function (class) names.