End Goal:
To create azure function running Botframework-DirectlineJS with binding to Bot (Framework)
using DirectLine secret.
Issue:
The above mentioned Botframework-DirectlineJS uses es6 export and Azure functions support Node 6.5.0 max doc. Hence the question how to import successfully the DirectlineJS in the index.js file of Azure function ?
Errror
```
2017-05-23T07:17:45.939 Exception while executing function: Functions.adapter. mscorlib: D:\home\site\wwwroot\adapter\importexportwrapper.js:1
(function (exports, require, module, __filename, __dirname) { import { DirectLine } from 'botframework-directlinejs';
^^^^^^
SyntaxError: Unexpected token import
at Object.exports.runInThisContext (vm.js:76:16)
at Module._compile (module.js:528:28)
at Object.Module._extensions.(anonymous function) [as .js] (D:\home\site\wwwroot\node_modules\node-hook\index.js:73:14)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (D:\home\site\wwwroot\adapter\index.js:4:2)
at Module._compile (module.js:556:32).
```
Currently the error was while trying to use npm import-export
Files
-
index.js
'use strict'; require('import-export'); require ('./importexportwrapper'); let directLine = new DirectLine({ secret: 'DirectlineSecretValue-here' } );
-
importexportwrapper.js
import { DirectLine } from 'botframework-directlinejs';
via ronpatel
No comments:
Post a Comment