dialogflow / dialogflow-javascript-client

JavaScript Web SDK for Dialogflow
Apache License 2.0
412 stars 173 forks source link

Missing index.js.map when using client in Ionic 3 web #64

Open gerhardcit opened 6 years ago

gerhardcit commented 6 years ago

In a basic ionic 3 app, I get this error when doing ionic serve

Error: Module build failed: Error: ENOENT: no such file or directory, open '/ionic-test/node_modules/api-ai-javascript/index.js.map'

I basically tried to adapt the lesson from https://angularfirebase.com/lessons/chatbot-in-angular-with-dialogflow-api-ai/ into a Ionic web (only) app and got stuck right at the start.

import { ApiAiClient } from 'api-ai-javascript';

then later

  readonly client = new ApiAiClient({ accessToken: this.dialogFlowToken });

but before we get there... the build error above apprear.

This works perfectly in Angular. So is it Ionic that is at fault having to have a .map file or is it because another error occurred and the typescript mapper needed a .map file to show the error.

Any change you can generate that .map file when building so it makes debugging or troubleshooting easier?

"@angular/common": "4.4.3",
    "@angular/compiler": "4.4.3",
    "@angular/compiler-cli": "4.4.3",
    "@angular/core": "4.4.3",
    "@angular/forms": "4.4.3",
    "@angular/http": "4.4.3",
    "@angular/platform-browser": "4.4.3",
    "@angular/platform-browser-dynamic": "4.4.3",
    "@ionic-native/core": "4.3.2",
    "@ionic-native/splash-screen": "4.3.2",
    "@ionic-native/status-bar": "4.3.2",
    "@ionic/storage": "2.0.1",
    "angular2-moment": "^1.7.0",
    "angularfire2": "^4.0.0-rc.2",
    "api-ai-javascript": "^2.0.0-beta.21",
    "firebase": "^4.4.0",
    "ionic-angular": "^3.7.1",
    "ionicons": "3.0.0",
    "moment": "^2.18.1",
    "object-path": "^0.11.4",
    "promise-polyfill": "6.0.2",
    "rxjs": "5.4.3",
    "sw-toolbox": "3.6.0",
    "zone.js": "0.8.18"
Wheelskad commented 6 years ago

Hello gerhardcit, A workaround before dialogflow team generate index.js.map, it work if you create the file yourself.

gerhardcit commented 6 years ago

Thanks @Wheelskad , would you be so kind as to give some tips and share your methods in this. I've not ventured into that space before. You could save a lot of people some effort.

Wheelskad commented 6 years ago

@gerhardcit, you have just to create an empty index.js.map into node_modules/api-ai-javascript and it works. Ionic (because it's not angular/typescript problem like you say) seems happy with it and you too :)

tstrohmeier commented 6 years ago

Same problem here.

Vivek-abstract commented 6 years ago

Thank you so much Wheelskad! That worked

robertlevy commented 6 years ago

Alternative workaround is to force the es6 version to be used instead of typescript:

import {ApiAiClient} from "api-ai-javascript/es6/ApiAiClient";

illiafilin commented 6 years ago

@gerhardcit, you have just to create an empty index.js.map into node_modules/api-ai-javascript and it works. Ionic (because it's not angular/typescript problem like you say) seems happy with it and you too :)

This is not enough if you'r using source-map package. You need to add {"version":1} into index.js.map to respect source-map package getArg params and prevent further errors throwing.