question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: 'h' is not exported by node_modules/preact/dist/preact.umd.js

See original GitHub issue

Hello,

We’re using Rollup with our preact application, however since the release of Preact 8.5.0 we receive the following error when building with rollup:

[!] Error: 'h' is not exported by node_modules/preact/dist/preact.umd.js
https://rollupjs.org/guide/en/#error-name-is-not-exported-by-module
src/Components/UI/index.tsx (1:20)
1: import { Component, h } from 'preact';

When we pin to 8.4.2 the build completes successfully. Looking at the comparison here I cannot see anything that could introduce breaking changes.

Kind regards,

Nathan

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
developitcommented, Aug 7, 2019

Hi @preeny95 - it seems like your Rollup may be configured to look for a "browser" field in package.json, but not to actually handle the contents it points to. The "browser" field can never point to an ES Modules build.

Are you able to post your Rollup configuration? If not, what we’re looking for is where you’ve done something like:

// rollup.config.js
import resolve from 'rollup-plugin-node-resolve';
export default {
  plugins: [
    resolve({
      // you likely have this specified, which is incorrect:
      mainFields: ['browser', 'module', 'main'],

      // or this, which is also incorrect:
      browser: true,  
    })
  ]
}

Instead, you’ll want to do this:

// rollup.config.js
import resolve from 'rollup-plugin-node-resolve';
export default {
  plugins: [
    resolve({
-      mainFields: ['browser', 'module', 'main'],
+      mainFields: ['module', 'browser', 'main'],

-      browser: true,  
    })
  ]
}
0reactions
preeny95commented, Aug 7, 2019

🎉 that’s done the trick it seems! Thank you!!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Rollup Error: 'default' is not exported by node_modules/react ...
js but I have trouble regarding the plugin @rollup/plugin-commonjs. My rollup.conf.js. import resolve from '@rollup/plugin-node-resolve'; ...
Read more >
Bundling Your JavaScript Library with Rollup | Risan Bagja
Error : 'default' is not exported by node_modules/lodash/random.js https://rollupjs.org/guide/en#error-name-is-not-exported-by-module- src/food.
Read more >
The "DxButtonModule is not exported by node_modules ...
The "DxButtonModule is not exported by node_modules\devextreme-angular\index.js" error occurs if ng-packagr is used.
Read more >
TypeScript errors and how to fix them
When you are importing a module with built-in TypeScript declarations and TypeScript tells you that this module does not have a default export, ......
Read more >
Common Error Details - Snowpack
Uncaught SyntaxError: The requested module './XXXXXX.js' does not provide an export named 'YYYYYY'#. If you are using TypeScript, this error could occur if...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found