Super expression is undefined when using rollup
See original GitHub issueWhen used with rollup it throws an error at runtime:
Uncaught TypeError: Super expression must either be null or a function, not undefined
at _inherits (root.js:25)
at root.js:38
at root.js:161
at createCommonjsModule (index.js:3)
at processor.js:254
With webpack works fine. And the app works fine until I add styled-components
.
I wasn’t sure if issue it here since it can be a problem with rollup-plugin-commonjs
or even react
…
I left a reproduction repo here: NicolasParada/styled-components
Issue Analytics
- State:
- Created 7 years ago
- Comments:13 (11 by maintainers)
Top Results From Across the Web
Flow rollup, react and babel TypeError: Super expression ...
I'm trying to use flow , babel and rollup , but my code breaks when adding flow. I have tried the rollup-plugin-flow and...
Read more >[Solved]-Flow rollup, react and babel TypeError - appsloveworld
Coding example for the question Flow rollup, react and babel TypeError: Super expression must either be null or a function, not undefined-babel.js.
Read more >Babelhelpers.Js Throws Super Expression Must Either Be Null ...
alejandronanez you can remove externalhelpers from your.babelrc file and enable it back only on your rollup.config.js using the ...
Read more >Javascript – Uncaught TypeError: this.method is not a function ...
electronjavascriptnode.jsrollup ... It should be said that app.js is the electron.js renderer process and it bundled using rollup.js.
Read more >GROUP BY - MariaDB Knowledge Base
As with the select expression, if you reference non-grouped columns in the HAVING clause, the behavior is undefined. By default, if a GROUP...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks to the amazing @Rich-Harris, we’re now bundling with Rollup which not only means a reduction of size for the UMD bundle, but also a
.es.js
bundle that will fix this issue!Okay, I’ve done some digging. It looks like this is one of this incredibly frustrating interop headaches caused by back-and-forth conversion between CommonJS and ES modules. Specifically, it looks like the
add-module-exports
Babel plugin is causing havoc, because it violates the expectation in rollup-plugin-commonjs that a module with__esModule: true
will haveexports.default
rather thanmodule.exports
.The good news is that it’s easy to fix – just use the dist file rather than bundling the library yourself:
Or, use the existing import but update your Rollup config:
Slightly off-topic, but as part of my digging I experimented with building this library with Rollup rather than Webpack (so that it could export an ES module bundle for the benefit of people using Webpack 2 or Rollup like @NicolasParada). The UMD build is 13% smaller (20,549 bytes gzipped down from 23,553) and parses roughly 60% quicker (~8ms in Chrome down from ~20ms, similar increase in Safari, less in Firefox). Any interest in a PR? Totally cool if not but the offer’s there 😀