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 is disallowed` occurs on non-page file when using `pageExtensions`

See original GitHub issue

What version of Next.js are you using?

12.0.7

What version of Node.js are you using?

14.176

What browser are you using?

Chrome

What operating system are you using?

macOS

How are you deploying your application?

Vercel

Describe the Bug

Re-exporting all exports from a page is disallowed

Have been rewritten with Rust but it seems to not care of pageExtensions option in next.config.js.

Expected Behavior

Re-exporting all exports from a page is disallowed Error shouldn’t occur on non-page files under /pages when using pageExtensions option.

To Reproduce

Create a fresh Next project with the pageExtensions set to ['page.tsx', 'page.ts'].

The pages folder looks like:

pages/
  users/
   index.page.tsx // import { UserComments } from './components';
   components/
      index.tsx // <= re-export all: export * from './UserComments';
      UserComments.tsx // contain a named export: export cont UserComments = () => <h1>User comments</h1>
     
package.json

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:2
  • Comments:5

github_iconTop GitHub Comments

2reactions
smitpatel1010commented, Jan 21, 2022

Hi, I was just checking the code to solve this issue for next-page-disallow-re-export-all-exports plugin. and I found one issue here https://github.com/vercel/next.js/blob/canary/packages/next/build/babel/loader/get-config.ts#L98

actual behaviour : isPageFile is true for components/index.tsx because it is inside pages folder. expected behaviour : isPageFile should be false here for components/index.tsx because of pageExtensions

I was just wondering from where I can get pageExtensions to pass it to getCacheCharacteristics ?

UPDATE: I found it for babel config. I am now exploring code for swc loader

UPDATE: raised PR

1reaction
raulfdmcommented, Apr 1, 2022

It’s a pity we didn’t have a response from anyone from the contributors. It was working, them a new feature or something introduced this bug and it’s there forever. I know there’s tons of issues opened, sprints on going but it has been 3 months.

I have to adapt my codebase as workaround for this problem (removing index.ts files even thought they don’t have .page extension).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Next js - disable server side rendering on some pages
Lazy load the component and disable SSR: https://nextjs.org/docs/advanced-features/dynamic-import#with-no-ssr
Read more >
next - npm
Every import you declare gets bundled and served with each page. That means pages never load unnecessary code! import cowsay from ...
Read more >
page extraction is not allowed in the source pdf documents
Solved: I am trying to combine multiple pdf files into 1 file. I keep getting this error - "page extraction is not allowed...
Read more >
Rewrites - next.config.js
fallback rewrites are checked/applied, these are applied before rendering the 404 page and after dynamic routes/all static assets have been checked. If you...
Read more >
Yii2-export: exported CSV/XLS contains html from page
I'm using yii2-export and it's almost all fine, except that I get some html of the page inside the exported file in Excel/CSV....
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