I'm currently running into [SyntaxError: Invalid or unexpected token] when trying to import image and load it onto src attribute. Here's the code:
import * as React from 'react';
import * as logo from '../../../../assets/logo.png';
export class EmailHeader extends React.Component {
render() {
return (
<table style={{width: "100%"}}>
<tbody>
<tr>
<td>
<img src={logo}></img> //this part throws an error
</td>
</tr>
</tbody>
</table>
)
}
}
Just importing "logo" works fine without error. But as soon as I add src={logo}, it throws the s yntax error message.
React SSR has been setup this way:
import * as ReactDOMServer from 'react-dom/server';
import { EmailHeader } from '../email/pages/EmailHeader';
///...
ReactDOMServer.renderToStaticMarkup(<EmailHeader/>)
I'm using Webpack 4 to bundle all my codes. Any help / idea would be extremely helpful! Thanks!