-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
Using JSX <img src={}> tags allows you to import images using require statements and have them correctly handled by webpack, but using the markdown  syntax does not generate a require statement, so the assets aren't processed by webpack.
It would be good to support {{importedVariable}} interpolation in the markdown syntax too.
It would be even nicer (in my opinion at least) if images were automatically transformed into webpack requires.
Markdown to reproduce:
---
imports:
myImg: ./img/img.png
---
- Image 1: 
- Image 2: 
- Image 3: <img src="./img/img.png" />
- Image 4: <img src={myImg} />
- Image 5: }})
- Image 6: <img src={require('./img/img.png')} />Actual output
import myImg from './img/img.png';
// ....snip....
<li>Image 1: <img src="./img/img.png" alt="img" /></li>
<li>Image 2: <img src="{myImg}" alt="img" /></li>
<li>Image 3: <img src="./img/img.png" /></li>
<li>Image 4: <img src={myImg} /></li>
<li>Image 5: <img src="{require('./img/img.png')}" alt="img" /></li>
<li>Image 6: <img src={require('./img/img.png')} /></li>
// ....snip....Expected output
import myImg from './img/img.png';
// ....
<li>Image 1: <img src="./img/img.png" alt="img" /></li>
<li>Image 2: <img src={myImg} alt="img" /></li>
<li>Image 3: <img src="./img/img.png" /></li>
<li>Image 4: <img src={myImg} /></li>
<li>Image 5: <img src={require('./img/img.png')} alt="img" /></li>
<li>Image 6: <img src={require('./img/img.png')} /></li>
// ....Thanks for the very cool webpack loader! I'd be open to creating a pull request if you can confirm which of the images in the example should be transformed into require statements
Metadata
Metadata
Assignees
Labels
No labels