IGNF / geoportal-extensions

French Geoportal Extensions for well-known javascript mapping libraries (Leaflet and OpenLayers)
https://ignf.github.io/geoportal-extensions/
Other
64 stars 33 forks source link

Erreur compilation par webpack : modules non trouvés pour leaflet et openlayers #294

Closed Gabriel-AL closed 3 years ago

Gabriel-AL commented 3 years ago

Bonjour,

Je souhaite utiliser votre extension afin d'afficher des cartes avec, notamment, les parcelles cadastrales. Utilisant Webpack, j'ai essayé tour à tour les versions Leaflet puis OpenLayers de l'extension, mais je rencontre à chaque fois le souci suivant :

ERROR  Failed to compile with 29 errors                                                                                                                                                                                                                        4:35:48 PM

Module build failed: Module not found:
"./node_modules/assert-plus/assert.js" contains a reference to the file "stream".
This file can not be found, please check it for typos or update it if the file got moved.

"./node_modules/aws-sign2/index.js" contains a reference to the file "crypto".
This file can not be found, please check it for typos or update it if the file got moved.

"./node_modules/aws4/aws4.js" contains a reference to the file "crypto".
This file can not be found, please check it for typos or update it if the file got moved.

"./node_modules/combined-stream/lib/combined_stream.js" contains a reference to the file "stream".
This file can not be found, please check it for typos or update it if the file got moved.

"./node_modules/delayed-stream/lib/delayed_stream.js" contains a reference to the file "stream".
This file can not be found, please check it for typos or update it if the file got moved.

"./node_modules/ecc-jsbn/index.js" contains a reference to the file "crypto".
This file can not be found, please check it for typos or update it if the file got moved.

"./node_modules/forever-agent/index.js" contains a reference to the file "http".
This file can not be found, please check it for typos or update it if the file got moved.

"./node_modules/forever-agent/index.js" contains a reference to the file "net".
This file can not be found, please check it for typos or update it if the file got moved.

"./node_modules/forever-agent/index.js" contains a reference to the file "tls".
This file can not be found, please check it for typos or update it if the file got moved.

"./node_modules/forever-agent/index.js" contains a reference to the file "https".
This file can not be found, please check it for typos or update it if the file got moved.

"./node_modules/http-signature/lib/signer.js" contains a reference to the file "crypto".
This file can not be found, please check it for typos or update it if the file got moved.

"./node_modules/http-signature/lib/signer.js" contains a reference to the file "http".
This file can not be found, please check it for typos or update it if the file got moved.

"./node_modules/isstream/isstream.js" contains a reference to the file "stream".
This file can not be found, please check it for typos or update it if the file got moved.

"./node_modules/oauth-sign/index.js" contains a reference to the file "crypto".
This file can not be found, please check it for typos or update it if the file got moved.

"./node_modules/request/lib/har.js" contains a reference to the file "fs".
This file can not be found, please check it for typos or update it if the file got moved.

"./node_modules/request/lib/hawk.js" contains a reference to the file "crypto".
This file can not be found, please check it for typos or update it if the file got moved.

"./node_modules/request/node_modules/mime-types/index.js" contains a reference to the file "path".
This file can not be found, please check it for typos or update it if the file got moved.

"./node_modules/request/request.js" contains a reference to the file "http".
This file can not be found, please check it for typos or update it if the file got moved.

"./node_modules/request/request.js" contains a reference to the file "https".
This file can not be found, please check it for typos or update it if the file got moved.

"./node_modules/request/request.js" contains a reference to the file "stream".
This file can not be found, please check it for typos or update it if the file got moved.

"./node_modules/request/request.js" contains a reference to the file "zlib".
This file can not be found, please check it for typos or update it if the file got moved.

"./node_modules/sshpk/lib/certificate.js" contains a reference to the file "crypto".
This file can not be found, please check it for typos or update it if the file got moved.

"./node_modules/sshpk/lib/ed-compat.js" contains a reference to the file "stream".
This file can not be found, please check it for typos or update it if the file got moved.

"./node_modules/sshpk/lib/formats/openssh-cert.js" contains a reference to the file "crypto".
This file can not be found, please check it for typos or update it if the file got moved.

"./node_modules/tough-cookie/lib/cookie.js" contains a reference to the file "net".
This file can not be found, please check it for typos or update it if the file got moved.

"./node_modules/tunnel-agent/index.js" contains a reference to the file "net".
This file can not be found, please check it for typos or update it if the file got moved.

"./node_modules/tunnel-agent/index.js" contains a reference to the file "tls".
This file can not be found, please check it for typos or update it if the file got moved.

"./node_modules/tunnel-agent/index.js" contains a reference to the file "http".
This file can not be found, please check it for typos or update it if the file got moved.

"./node_modules/tunnel-agent/index.js" contains a reference to the file "https".
This file can not be found, please check it for typos or update it if the file got moved.

Votre environnement

Type d'issue

[x] Report de bug [ ] Requête d'une nouvelle fonctionnalité

Pour les bugs : Etapes à suivre pour le reproduire

  1. Installer webpack-encore
  2. Installer leaflet/openlayers
  3. Créer un début de projet simple et vérifier s'il fonctionne (ok, de mon côté)
  4. Installer geoportal-extensions-[leaflet||openlayers]
  5. Adapter le projet en incluant les exemples proposés par la documentation, relancer npm run dev-server

Comportement attendu

Une compilation successful par webpack

Comportement actuel

Maintes erreurs

Possible Cause/Correction/Solution technique (facultatif)

Mon confrère suggérait ici la possibilité que cela vienne de deprecations. Si tel est le cas, leur nombre a dû augmenter !

S'il vous faut du temps pour résoudre ce bug-ci, j'apprécierais d'en avoir une estimation. Le plugin est très important pour mon projet !

lowzonenose commented 3 years ago

Bonjour,

je vous renvoie vers les projets suivants : https://github.com/IGNF/geoportal-third-party-integration C'est un dépôt d'exemples d'intégration des API Géoportail dans différents frameworks de type "Web Framework Front-End JS", tels que Angular, React, Ember, Meteor, Vue...

cf. https://github.com/IGNF/geoportal-third-party-integration/blob/master/simple-map-openlayers-angular/README.md

lowzonenose commented 3 years ago

Bonjour,

est il possible de tester le correctif dans votre projet ?

Les plugins n'étant pas encore publiés (pre-release), il faut que vous ajoutiez dans votre package.json la ligne suivante :

"geoportal-extensions-openlayers": "https://raw.githubusercontent.com/IGNF/geoportal-extensions/feature-change-request-dep/build/scripts/release/geoportal-extensions-openlayers-3.0.14.tgz",
"ol": "5.3.0",

ou

"geoportal-extensions-leaflet": "https://raw.githubusercontent.com/IGNF/geoportal-extensions/feature-change-request-dep/build/scripts/release/geoportal-extensions-leaflet-2.1.8.tgz",
"leaflet": "1.7.1",

merci

ThomasFeuillatre commented 3 years ago

Bonjour, J'avais le même soucis que Gabriel-AL, votre solution à régler mon soucis pour l'instant. merci