Skip to content

exporting an imported value is not live (T7180) #4154

Closed

Description

@babel-bot

Issue originally made by @kolodny

Input code

import { foo } from 'bar';
export { foo };

Description

currently the output is

'use strict';

Object.defineProperty(exports, '__esModule', {
  value: true
});

var _bar = require('bar');

exports.foo = _bar.foo;

However the following code produces what this should producer:

// input
export { foo } from 'bar'

// output
'use strict';

Object.defineProperty(exports, '__esModule', {
  value: true
});

var _bar = require('bar');

Object.defineProperty(exports, 'foo', {
  enumerable: true,
  get: function get() {
    return _bar.foo;
  }
});

To duplicate:

cd $(mktemp -d -t tmp)
npm init -y > /dev/null
npm i -D babel-core babel-cli babel-preset-es2015 > /dev/null
echo '{ "presets": ["es2015"] }' > .babelrc
echo "import { foo } from 'bar'; export { foo };" > index.js
./node_modules/.bin/babel index.js

Activity

  1. added
    outdated
    on May 4, 2018
  2. locked as resolved and limited conversation to collaborators on May 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: modulesoutdated

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions