renchap/webpacker-react

webpacker-react: cant render a component that has not been registered: Test

Closed this issue · 3 comments

After getting everything running on development, I finally tried rolling out my new Webpacker based setup to production, and I'm getting this error.

Test is registered normally in my pack and this works on development just fine:

import Test from 'components/test';
import WebpackerReact from 'webpacker-react';

WebpackerReact.register(Test);

Is there any additional step needed for the react_component helper to work in production?

This is a known issue with 0.1.0, it will be fixed in the next version.
In the meantime, you can change config/webpack/production.js to not mangle the name of your root components:

    new webpack.optimize.UglifyJsPlugin({
      mangle: {
        except: ['Test'] // remove this once webpacker-react 0.2 is released
      }
    }),

That worked, I'll add it to my write-up. Thanks!

The new version is now released and fixes this issue!
Please look at the CHANGELOG, the API changed (setup replaced register).