Requiring library with multiline strings adds tabs
See original GitHub issueIn my project I am requiring in a library from node_modules which contains a block of code similar to the following:
var someVariable = 'line1\
line2\
line3\
line4';
This is a valid, though not recommended, way to use multiline strings in Javascript. The issue occurs after I bundle my project with WebPack. The output looks something like this:
.. function(module,exports,__webpack_require__){ /* other code */ var someVariable='line1 line2 line3 line4'; ...
Tabs are added into the multiline string. I get the same result even when I don’t minify/uglify the output. The block of code is indented in the output and the multiline string now has the same tabs prepended to each line:
var someVariable = 'line1\
line2\
line3\
line4';
Is there something I’m doing wrong that multiline strings get their values changed, or is this a bug in WebPack?
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:10 (4 by maintainers)
Top Results From Across the Web
Proper indentation for multiline strings? - python
When I need a non long string in my code I find the following admittedly ugly code where I let the long string...
Read more >Changing the Indentation of a Multiline String - O'Reilly
Problem. You have a string made up of multiple lines, and you need to build another string from it, adding or removing leading...
Read more >Proper Indentation for Python Multiline Strings - Finxter
In this article we are going to look at how to properly indent your code for Python multiline strings, so let's start by...
Read more >Coding conventions | Kotlin Documentation
val mutableCollection: MutableSet<String> = HashSet() ... if the initializer is long, add a line break after the = sign and indent the ...
Read more >Python multi-line string literals with textwrap.dedent()
You're writing some Python, and you need to write out a string containing ... You could manually add that leading whitespace, but there's...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Could
output.sourcePrefix
default to''
? I was bitten by this recently. Tabs seem to be to dangerous for ES6 multiline strings.Issue was closed because of inactivity.
If you think this is still a valid issue, please file a new issue with additional information.