Summary
When I load my app using Webpack Dev Server, my messages show up fine:
\
. However when I bundle the application to disk and server the bundle vianginx
, I see a duplication of my backslash:\\
.
Details
I am using react-intl
@2.2.3 (latest at this time) and babel-plugin-react-intl
@2.3.1 (latest at this time.) My goal is to define a default message with a \
character and render it in any way (FormattedMessage
, formatMessage
, etc)
I am bundling my app using Webpack / Babel. I have no Babel / react-intl specific config in my webpack.config.js
file, however I do use DefinePlugin
to set process.env
to 'development'
or 'production'
When I load my app using Webpack Dev Server, my messages show up fine: \
. However when I bundle the application to disk and serve the bundle via nginx
, I see a duplication of my backslash: \\
. I have following instructions here: https://github.com/yahoo/babel-plugin-react-intl/issues/13#issuecomment-151944191 with regard to using 4 \
characters to show a final \
character.
For what it is worth, I have tried using JSX strings, JS strings, using 1, 2, and 4 \
characters, and any other silly combinations I could think of.
Any tips or suggestions are greatly appreciated. Thank you.
Code samples
An example of how I define messages
import { defineMessages } from 'react-intl'
export default defineMessages({
message: {
id: 'anyId',
defaultMessage: '\\\\',
},
})
An example of how I might render my messages
<FormattedMessage { ...messages.anyID } /></span>
Another example, which also does not work
<FormattedMessage id='anyId' defaultMessage='\\' />
Yet another failing example:
<FormattedMessage id='anyId' defaultMessage={ '\\\\' } />