Loading a dynamic file at run time
ImranAhmed opened this issue · 1 comments
ImranAhmed commented
Hi,
I am trying to use this to load a file at run time which I can change dynamically. The file lives in my /dist folder. Any ideas? Thanks.
webpack v2.2.1
react v15.4.2
markdown-loader v2.0.0
react-markdown v2.5.0
ImranAhmed commented
I manged to achieve this using a different loader: file-loader.
Configured in webpack as follows:
{
test: /\.(md)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'file-loader'
}
I then reference the .md file in my React component as follows:
const status = require('../../../content/home/status.md');
And render using react-markdown.
<ReactMarkdown source={status} />