Closed kmolerov closed 7 years ago
How about add 'leaflet/index': 'L', in globals?
Does not work. I have tried with 'leaflet/index': 'L', with 'leaflet': 'L' and with both. Still the result is Module not found: Error: Can't resolve 'leaflet/index'.
I have precisely the same issue. Any help would be very much appreciated.
I have finally solved this with the help of @adamlubek from issue #31. All that is needed in globals is 'leaflet/index': 'L' and then path has to be configured paths: { 'leaflet/index': 'leaflet' }.
I don't know how to properly configure build.js to include leaflet (https://github.com/Leaflet/Leaflet). It seams that leaflet has a module definition, as I was able to use it inside angular cli project, without configuring anything (exept css), so there must be a way to use it inside rollup bundle.
Currently I have configure it by adding 'leaflet': 'L', in globals (build.js). Then when I use it in project with ng-cli I receive the following error: Module not found: Error: Can't resolve 'leaflet/index'.
Note: I have leaflet & types/leaflet in my project. I am importing leaflet inside a component with *import as L from 'leaflet';** Then when I build the library project I receive the following warning: 'leaflet/index' is imported by out-tsc\lib-es2015\src\components\map\map.component.js, but could not be resolved – treating it as an external dependency 'leaflet/index' is imported by out-tsc\lib-es5\src\components\map\map.component.js, but could not be resolved – treating it as an external dependency No name was provided for external module 'leaflet/index' in options.globals – guessing 'L' No name was provided for external module 'leaflet/index' in options.globals – guessing 'L'