For an application using angular2 (from angular-cli with webpack), i need to consume some data in xml from a soap web service.The angular-cli that i use provide natively the library xml2js for parsing xml to json but when i try to use this library in my component using the following syntax:
import {Parser} from 'xml2js';
i got the message:
Cannot find module 'xml2js'.)
However, this library is really installed on the node_modules file.
I searched everywhere but i only found some solutions with system.js config.
Does anyone know how to use this library in an angular2 using webpack?
You need to install the type definitions for xml2js
NPM:
npm install @types/xml2js --save-dev
YARN:
yarn add @types/xml2js -D
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With