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.

Re-exporting all exports from a page should be disallowed

See original GitHub issue

Bug report

Describe the bug

Using export * from '...' in a page shouldn’t be allowed by Next.js.

To Reproduce

Create two pages:

// pages/one.js
import fs from 'fs';

export default function A() {
  return <main />
}

export function getStaticProps() {
  fs;
  return { props: { } };
}
// pages/two.js
export * from './one'

This causes the following error:

Module not found: Can't resolve 'fs' in './pages/two.js'

Expected behavior

An build error should occur.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
Timercommented, Jun 17, 2020
export {default} from '...'

is a fine behavior!

1reaction
timneutkenscommented, Jun 9, 2020

@Timer I came up with naive implementation regexing the page, but I’m quite sure there is a more “appropriate/elegant” way to achieve that. Maybe I should look into webpack?

It can be achieved using a babel plugin

Read more comments on GitHub >

github_iconTop Results From Across the Web

export-all-in-page - Next.js
Re-exporting all exports from a page is disallowed. Why This Error Occurred. The following export can potentially break Next.js' compilation of pages:
Read more >
Disallow Export * from "" - Stack Overflow
So I have a React app and I want to disable re-exporting all the exports. Here is an example which should give me...
Read more >
Re-export values from another file in JavaScript | bobbyhadz
To re-export values from another file in JavaScript, make sure to export the name exports as `export {myFunction, myConstant} from '.
Read more >
Deemed Exports FAQs - What is a "deemed re-export"?
BIS will apply the licensing policy set forth in §746.5, "Russian Industry Sector Sanctions," to the review of all license applications for controlled...
Read more >
no-restricted-exports - ESLint - Pluggable JavaScript Linter
Only the names you specify in the configuration will be disallowed. ... This rule doesn't inspect the content of source modules in re-export...
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