Closed eric-burel closed 1 year ago
Thank you for filling this issue.
I've tested your example using motdotla/dotenv and joho/godotenv
In both test, the comment is actually treated as comment (ignored)
The FOOBAR
value in this case is <empty string>
To treat any string with hash (#
) as part of the value itself instead of comment, you actually need to wrap it in quotes:
# this is a comment
FOOBAR=value
FOOBAR_COMMENT=value # comment
FOOBAR_QUOTED="value"
FOOBAR_QUOTED_COMMENT="value" # comment
FOOBAR_EMPTY=
FOOBAR_EMPTY_COMMENT= # comment
FOOBAR_EMPTY_QUOTED_COMMENT="" # comment
FOOBAR_QUOTED_HASH="value # comment"
FOOBAR_SQUOTED_HASH='value # comment'
just in case GitHub syntax highlighting is not working:
What env parser implementation are you using?
Is the # set foobar here
in FOOBAR= # set foobar here
actualy treated as value?
Hi, thanks for your fast reply and experiment, this helped a lot understanding the issue.
This is an issue that affects Next.js apps during build, I've built a repro.
Closing this issue as indeed inline comments are expected to work as intended with dotenv, so your plugin works as expected.
Example:
Result:
The comment should be displayed as text.
I think more broadly anything after "=" should be displayed in the same color, avoiding risks of confusions