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

Template string optimization incorrectly result in "undefined" #279

Closed
webpack-bot opened this issue Apr 25, 2018 · 1 comment
Closed

Template string optimization incorrectly result in "undefined" #279

webpack-bot opened this issue Apr 25, 2018 · 1 comment

Comments

@webpack-bot
Copy link

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants