-
Notifications
You must be signed in to change notification settings - Fork 659
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Broken export when using Webpack 2 (React.createElement: type should not be null) #190
Comments
Just spent an entire day with @Bonitis trying to track down an issue that has this at its root. Good find, @halt-hammerzeit! |
+1 |
Looking into this issue. Not having it with |
@andykenward I'm having it with |
Are you using the Lines 5 to 7 in f0b971c
As you need to set your babel config like this if using https://github.com/andykenward/bob/blob/develop/package.json#L47-L57 |
@andykenward Why wouldn't I use "es2015 modules"? |
It works if I remove |
@halt-hammerzeit that is why you set it to Check the docs. Under Options
|
@andykenward Well, my {
test : /\.js$/,
include :
[
path.resolve(frontend_root_folder, 'code')
],
loader: 'babel-loader'
} And I don't know how all this thing with Webpack and |
So, it seems like a non- |
@andykenward So why do you set your |
@halt-hammerzeit no i compile to ES5 javascript. That is why you use babel in the first place. To compile ES6/ES2015 code to ES5. By setting the read the doc for
And if you want webpack 2 to be able to go into any npm packages that are built with support for ES6/ES2015 version and tree shake those then you need to stop the modules transform. Otherwise you might aswell use the ES5 versions of the npm packages There is a blog post about Tree-shaking with webpack 2 and Babel 6. Explaining this more. But the babel setup is outdated and you can now just set |
Oh but you may need to use the |
@andykenward Well, okay, though I didn't understand a thing about all this alchemy. So, now I understand, that what |
@halt-hammerzeit Apologies for the confusion with the babel setup. We are looking into seeing how we can fix this. Just want to be clear, you were using this library @ v3.1.0 with no problems and now with v3.2.1 your webpack build automatically picks up the @andykenward We would prefer not to have people add special babel configuration to consume the library properly. I thought that adding the |
@cwelch5 3.1.0 work fine. issue only for ^3.2.0. |
@cwelch5 Yeah, I added |
@cwelch5 The issue is that the ES6 compiled version that is in There are a few articles about this Misunderstanding ES6 Modules, Upgrading Babel, Tears, and a Solution I suggest we follow how for example redux is
and you import in your project as
So then you would have to do Or i can just compile the Let me know either way and I can do a pull request in a bit. This shouldn't effect people using the ES5 version |
@andykenward That is a major change to the consumption API, which we should not do on a minor bump. |
@doctyper perhaps it would be best to remove https://github.com/nfl/react-helmet/blob/master/package.json#L6-L7 Then wait for a major release to implement it |
See pull request #197 |
Apologies for the headache on this. This is now fixed in v3.2.2 |
@cwelch5 @andykenward are there any plans to revert this change and expose ES6 modules? :) There have been a few major releases since then! |
#395 <- uses rollup in instead of webpack to export the modules. This will allow for ESM exports. |
In
3.1.0
the export is not broken:typeof require('react-helmet') === 'function'
.In
3.2.0
it is broken:typeof require('react-helmet') === 'object'
.The error is "Warning: React.createElement: type should not be null, undefined, boolean, or number. It should be a string (for DOM elements) or a ReactClass (for composite components). Check the render method of
Layout
."The cause is that
v3.2.x
ofReactHelmet
is{ default: function ReactHelmet() {} }
when imported in Webpack 2.The text was updated successfully, but these errors were encountered: