Skip to content
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

Errors in dynamic imports are silenced #14

Open
onlyfortesting opened this issue May 7, 2020 · 2 comments
Open

Errors in dynamic imports are silenced #14

onlyfortesting opened this issue May 7, 2020 · 2 comments
Labels
help wanted Extra attention is needed

Comments

@onlyfortesting
Copy link

Current Behavior

no page error, no console output, no term output.

Steps to Reproduce (for bugs)

// pages/index.js
import dynamic from 'next/dynamic'
const TestLoader = dynamic(import('../components/Test'), { ssr: false})
export default () => <TestLoader />

// components/Test.js
throw new Error('test')
export default () => <div>hello</div>
@developit
Copy link
Owner

seems like an aliasing bug where next/dynamic is getting a copy of react. I haven't tried this yet, will have to in order to see what's going on.

@developit developit added the help wanted Extra attention is needed label Oct 5, 2020
@barelyhuman
Copy link

barelyhuman commented Jun 18, 2021

@developit @onlyfortesting
You're better off reporting that to the next team since it doesn't work on the official next template either.

As for why it works on the default import is as the file is executed as a node module before reading the component , thus breaking on the normal.

Changing it to this

const error = ()=>{
  throw new Error("test");
}

const Test = () => {
  error();
  return <div>hello</div>;
};

export default Test;

Gave me the requested error.

Though if you are seeing this happen in a project, please create a similar snippet, would help in debugging

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants