You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
const date = new Date();
const day = date.getDate() >= 10 ? date.getDate() : "0" + date.getDate() ;
const month = date.toLocaleString('default', { month: 'long' }).substring(0,3);
const year = date.getFullYear();
const englishDate = `${day} ${month}, ${year}`;
Suppose that today's date is 6/8/2023. The englishDate is supposed to have a string value of "08 Jun, 2023". However, the value it got on production after the bundle is "08Jun,2023". All the spaces within the string is removed.
I checked the bundled file, it turned out that the spaces are remove in the code when being bundled. The last line became
const englishDate = `${day}${month},${year}`;
However, If I don't use variables inside the string enclosed by backticks (`). Such as
const englishDate = `June 8th, 2023`;
All the spaces in the string will be preserved.
It seems like this issue only happened when a variable is used within a template string. All the spaces followed by the variable will be removed by the bundler.
Can anyone replicate it and let me know?
The text was updated successfully, but these errors were encountered:
So in my production environment, i use Bundle imported from flask_assets.
Then in my JavaScript file, I have the following
Suppose that today's date is 6/8/2023. The englishDate is supposed to have a string value of "
08 Jun, 2023
". However, the value it got on production after the bundle is "08Jun,2023
". All the spaces within the string is removed.I checked the bundled file, it turned out that the spaces are remove in the code when being bundled. The last line became
However, If I don't use variables inside the string enclosed by backticks (`). Such as
All the spaces in the string will be preserved.
It seems like this issue only happened when a variable is used within a template string. All the spaces followed by the variable will be removed by the bundler.
Can anyone replicate it and let me know?
The text was updated successfully, but these errors were encountered: