mangony icon indicating copy to clipboard operation
mangony copied to clipboard

When not using jsx templater still get `Cannot find module 'react-dom/server'`

Open windgazer opened this issue 3 years ago • 2 comments

I would like to use the latest version of Mangony to build a markdown based static site. However, due to the plugin setup I'm forced to either install react-dom, or at least fake it :(

To reproduce, install mangony on a fresh repo, grab the 'prod' example from readme and run it. Even though using the hbsTemplaterPlugin instead of the jsx templater, the plugin gets called and attempts (and fails) to import react-dom/server.

Work-around: Create a fake node_modules/react-dom/server.js that exports an empty object...

windgazer avatar Jan 06 '22 19:01 windgazer

I will take a look today... Thx for highlighting it.

Sebastian-Fitzner avatar Jan 07 '22 08:01 Sebastian-Fitzner

@windgazer Sry for the late reply. I have taken a look at it and you can easily work around this by using the direct import:

const Mangony = require('mangony/lib/mangony');
const HbsTemplater = require('mangony/lib/plugins/hbs-templater');
const ServerPlugin = require('mangony/lib/plugins/server');

This way the dependencies for other plugins are not loaded. I will add a peerDependency to the lib for installation hints. And I will update the docs for that.

Sebastian-Fitzner avatar Mar 01 '22 11:03 Sebastian-Fitzner