technicalindicators: regeneratorRuntime is not defined

Hi, I used technicalindicators for a while, and it’s quite good somehow. However, I just upgrade to 1.0.4 today and found the issue which is not obvious to me. Can you please check, thanks!

==============Install============= $ npm install technicalindicators test@1.0.0 E:\data\test -- technicalindicators@1.0.4 – babel-polyfill@6.23.0 ±- babel-runtime@6.23.0 ±- core-js@2.4.1 `-- regenerator-runtime@0.10.5

==============Run============= $ node var macd = require(‘technicalindicators’).macd ReferenceError: regeneratorRuntime is not defined at E:\data\test\node_modules\technicalindicators\dist\browser.js:1:16646 at e.window (E:\data\test\node_modules\technicalindicators\dist\browser.js:1:17293) at Object.<anonymous> (E:\data\test\node_modules\technicalindicators\dist\browser.js:2:14270) at Module._compile (module.js:570:32) at Object.Module._extensions…js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.require (module.js:497:17) at require (internal/module.js:20:19)

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 15 (8 by maintainers)

Most upvoted comments

@dandv @aastein Just to clarify this package uses babel to transpile es6 code so if you are using it in browser you should use regeneratorRuntime or use custom transpiler. If you want to use it in node or use a custom bundler like webpack we have module flag in https://github.com/anandanand84/technicalindicators/blob/master/package.json#L7 I am not familiar with webpack I use rollup. I tried your example and it did fail. A quick google search shows webpack didn’t honor the module field, if we add the following in your webpack.config.js you should be good. I tested and it works fine. Let me know if it didn’t work.

module.exports = {
  resolve: {
    mainFields: ["module", "main"]
  }
}

For more info on mainFields take a look at https://webpack.js.org/configuration/resolve/#resolve-mainfields image