Closed ThierryNormand closed 10 months ago
I have the following in my project (also with geostyler-legend v4.0.0 but vite/React and without Angular), which works fine for me:
import GeostylerLegendRenderer from 'geostyler-legend/dist/LegendRenderer/LegendRenderer'
Just making sure that you have tried using the default export? If so, how did you originally try to import LegendRenderer that gave you the error _ _WEBPACK_IMPORTEDMODULE is not a constructor?
I tried using the default export, which gave the WEBPACK error. Trying to solve the error as I have done with Geostyler gave me the error stated in my post. As noted in my initial post, I think the LegendRenderer class is missing an export statement.
Any updates?
I added a named export in #444
The fix is contained in 4.0.1
Thank you!
Describe the bug When importing the library for an Angular project, I get the error __WEBPACK_IMPORTEDMODULE is not a constructor. To solve this problem, I used the following syntax which worked for a similar problem with OlStyleParser:
import { LegendRenderer as MyLegendRenderer } from 'geostyler-legend/dist/LegendRenderer/LegendRenderer';
However, I get the error :Module '"geostyler-legend/dist/LegendRenderer/LegendRenderer"' has no exported member 'LegendRenderer'.
Expected behavior I should not receive an error for the import.
Version
Additional context I found that the declaration of LegendRenderer class has no "export" like OlStyleParser. Adding
**export** declare class LegendRenderer{...}
solves the problem.