3.0.0-rc.1: Object destructuring and import name getting confused

Do you want to request a feature or report a bug?
Bug

If the current behavior is a bug, please provide the steps to reproduce.

Project setup

./src/icon/svg/svg1.js

export const svg1 = 1;

./src/icon/svg/svg2.js

export const svg2 = 2;

./src/icon/svg/index.js

import { svg1 } from "./svg1";
import { svg2 } from "./svg2";

const clinical1 = {
    svg1
};
const clinical2 = {
    svg2
};

export {
    clinical1,
    clinical2
};

./src/icon/index.js

import * as svg from "./svg";

const {
    clinical1: {
        svg1
    }
} = svg;

export {
    svg1
};

Webpack entry file: ./src/icon/index.js

Issue

Output

// CONCATENATED MODULE: ./src/icon/svg/svg1.js
const svg1 = 1;

// CONCATENATED MODULE: ./src/icon/svg/svg2.js
const svg2 = 2;

// CONCATENATED MODULE: ./src/icon/svg/index.js
var svg_namespaceObject = {};
__webpack_require__.d(svg_namespaceObject, "clinical1", function() { return clinical1; });
__webpack_require__.d(svg_namespaceObject, "clinical2", function() { return clinical2; });

const clinical1 = {
    svg1: svg1
};
const clinical2 = {
    svg2: svg2
};

// CONCATENATED MODULE: ./src/icon/index.js
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "svg1", function() { return icon_svg1; });

const {
    clinical1: {
        icon_svg1
    }
} = svg_namespaceObject;
  • icon_svg1 is not defined on clinical1.

Please mention other relevant information such as the browser version, Node.js version, webpack version and Operating System.

OS: Windows
Webpack: 3.0.0-rc.1
Node: 8

Author: Fantashit

1 thought on “3.0.0-rc.1: Object destructuring and import name getting confused

Comments are closed.