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

TypeError: require.resolveWeak is not a function #11

Open
ellioseven opened this issue Dec 1, 2019 · 2 comments
Open

TypeError: require.resolveWeak is not a function #11

ellioseven opened this issue Dec 1, 2019 · 2 comments

Comments

@ellioseven
Copy link

I am getting the following error when attempting to dynamically load within a babel compiled component:

TypeError: require.resolveWeak is not a function

The compiled contents looks like so:

var AuthMenu = (0, _dynamic.default)(function () {
  return _promise.default.resolve().then(function () {
    return (0, _interopRequireWildcard2.default)(require("@connect/web-auth/lib/container/AuthMenu/AuthMenu"));
  });
}, {
  loadableGenerated: {
    webpack: function webpack() {
      return [require.resolveWeak("@connect/web-auth/lib/container/AuthMenu/AuthMenu")];
    },
    modules: ["@connect/web-auth/lib/container/AuthMenu/AuthMenu"]
  }
});

I am wondering if this package supports this scenario?

@JoaoFGuiomar
Copy link

I'm getting the same error after updating to Next 9.1.

But I get different errors when I run test or test --watch

with test
Captura de ecrã 2019-12-04, às 10 37 10

with test --watch
Captura de ecrã 2019-12-04, às 10 27 14

@jeffryang24
Copy link

I also got error in Next 9.1, but mine is: TypeError: LoadableComponent.preload is not a function. Temporarily, I solved it by mocking next-server/dynamic and next/dynamic. Don't know why the error occurred while in line 35 (index.js) already prevented it. 🤔

jest.mock('next-server/dynamic', () => {
  return jest.fn(() => 'Dynamic');
});
jest.mock('next/dynamic', () => {
  return jest.fn(() => 'Dynamic');
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants