Skip to content
This repository was archived by the owner on Dec 5, 2019. It is now read-only.
This repository was archived by the owner on Dec 5, 2019. It is now read-only.

Template string optimization incorrectly result in "undefined" #279

@webpack-bot

Description

@webpack-bot

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

What is the current behavior?
Bad optimization in template string. Changes a valid result to undefined

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

Js file to repro

// test.js
var msg = getMsg({value: 1});
console.log(`${ msg } <= should not be undefined`);
function getMsg({value}) {
// Doesn't seem to repro if there is no multiline here
  return `\
${value}`;
}

Command to run

npx webpack test.js -o out.js
node out.js

The console.log is reduced to console.log("undefined <= should not be undefined")

What is the expected behavior?
The resulting bundle should print 1 <= should not be undefined

If this is a feature request, what is motivation or use case for changing the behavior?

Please mention other relevant information such as the browser version, Node.js version, webpack version, and Operating System.
Node v9.5.0
Webpack v4.6.0
Webpack-cli v2.0.15


This issue was moved from webpack/webpack#7121 by @evilebottnawi. Original issue was by @Cellule.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions