Hi Éverton Roberto Auler,
Bogdan Nicovski
1

Yes, Bogdan Nicovski

This md2 library uses the ES6 module syntax, you’ll need to add the following lines to your webpack.config.js file

externals: [nodeExternals({
whitelist: [
/^md2/
]
})],

By default when you are targeting node, webpack will not include your libraries inside node_modules to the dist/server.js bundle, but the libraries you use which are build with the ES6 module syntax, you will need to added manually to this whitelist array, to force webpack to add them to the dist/server.js bundle, because node.js don’t support the ES6 module syntax yet.

I’m not sure that the md2 library was build with server sider rendering in mind, after you fix your webpack.config.js file, if any ‘document or window is not define’ shows up in your terminal, unfortunately you will not bee able to deploy your application with SSR.

Show your support

Clapping shows how much you appreciated Éverton Roberto Auler’s story.