markdalgleish / react-to-html-webpack-plugin

Webpack plugin that renders React components to HTML files
MIT License
168 stars 14 forks source link

Can't require "./MyComponent.jsx" #9

Closed soluml closed 8 years ago

soluml commented 8 years ago

Been trying to implement this plugin to test React out as a templating system for HTML. Using a hashed source file, I'm able to access "main" just fine in my directory structure, but no matter what I use inside of index.jsx, I'm unable to require any of my other components in.

I keep getting the generic Error: Cannot find module "./src/html/components/head.jsx" error. I didn't see any examples to play with and there's no mention of MyComponent.jsx anywhere else in the README other than you requiring it into index.jsx. I assumed the require path would be relative to the location of my index.jsx file, but that doesn't seem to be the case with this plugin.

Any ideas?

soluml commented 8 years ago

So I was able to resolve this by messing around with webpack's resolve.root object. Just wanted to put this here in case someone else runs across this issue.