Skip to content

import doesn't work in babel-node interactively #1264

Closed
@Macil

Description

This used to work for me in 4.x, but since updating it doesn't seem like import works interactively any more.

[chris /tmp/aaa]$ npm i kefir
kefir@1.3.1 node_modules/kefir
[chris /tmp/aaa]$ babel-node --version
5.1.9
[chris /tmp/aaa]$ babel-node
> import Kefir from 'kefir';
'use strict'
> Kefir
ReferenceError: Kefir is not defined
    at [object Object]:3:1
    at _eval (/usr/local/lib/node_modules/babel/bin/_babel-node:54:13)
    at REPLServer.replEval [as eval] (/usr/local/lib/node_modules/babel/bin/_babel-node:136:14)
    at Interface.<anonymous> (repl.js:239:12)
    at Interface.emit (events.js:95:17)
    at Interface._onLine (readline.js:203:10)
    at Interface._line (readline.js:532:8)
    at Interface._ttyWrite (readline.js:761:14)
    at ReadStream.onkeypress (readline.js:100:10)
    at ReadStream.emit (events.js:98:17)
> [chris /tmp/aaa]$ 
[chris /tmp/aaa]$ echo "import Kefir from 'kefir'; console.log(Kefir);"|babel-node
> import Kefir from 'kefir'; console.log(Kefir);
{ DEPRECATION_WARNINGS: true,
  Observable: [Function: Observable],
  Stream: [Function: Stream],
  Property: [Function: Property],
  withInterval: [Function],
  fromPoll: [Function],
  interval: [Function],
  sequentially: [Function],
  repeatedly: [Function],
  later: [Function],
  merge: [Function],
  concat: [Function],
  Pool: [Function: Pool],
  pool: [Function],
  Bus: [Function: Bus],
  bus: [Function],
  zip: [Function],
  combine: [Function],
  sampledBy: [Function],
  fromBinder: [Function],
  emitter: [Function],
  Emitter: [Function: Emitter],
  never: [Function],
  constant: [Function],
  constantError: [Function],
  repeat: [Function],
  and: [Function],
  or: [Function],
  fromCallback: [Function],
  fromNodeCallback: [Function],
  fromPromise: [Function],
  fromSubUnsub: [Function],
  fromEvent: [Function],
  Kefir: [Circular] }
undefined
> [chris /tmp/aaa]$ 

Metadata

Assignees

No one assigned

    Labels

    outdatedA closed issue/PR that is archived due to age. Recommended to make a new issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions