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

HookWebpackError when running with next.js #40

Closed
karlsander opened this issue Mar 4, 2022 · 3 comments
Closed

HookWebpackError when running with next.js #40

karlsander opened this issue Mar 4, 2022 · 3 comments

Comments

@karlsander
Copy link

I'm trying to get tamagui up and running with next.js but I cannot seem to make it work with my config.

I always get the following error (when I try to load the first page, not during startup):

error - HookWebpackError: Cannot read property 'replace' of undefined
error - unhandledRejection: HookWebpackError: Cannot read property 'replace' of undefined

I have no idea how to start finding the issue because this doesn't even mention a file inside webpack or anything.
I am trying to run it together with expo, maybe that's not supported?

Here is my next config:

process.env.TAMAGUI_TARGET = "web";

const { withExpo } = require("@expo/next-adapter");
const { withTamagui } = require("@tamagui/next-plugin");
const withTM = require("next-transpile-modules");
const withPlugins = require("next-compose-plugins");

const transform = withPlugins(
  [
    withTM(["shared", "mobile", "date-fns", "@expo/vector-icons"], {
      resolveSymlinks: true,
    }),
    withExpo,
    withTamagui({
      config: "../shared/utils/tamagui.config.ts",
      components: ["tamagui"],
      importsWhitelist: ["constants.js", "colors.js"],
      logTimings: true,
      disableExtraction: false,
      excludeReactNativeWebExports: ["Switch", "ProgressBar", "Picker"],
    }),
  ],
  {
    projectRoot: __dirname,
    typescript: {
      ignoreBuildErrors: true,
    },
  }
);

module.exports = function (name, { defaultConfig }) {
  return transform(name, { defaultConfig });
};

Resolved versions of relevant packages are:

  • next@12.1.0
  • webpack@5.70.0
  • @tamagui/next-plugin@1.0.0-alpha.68
  • tamagui@1.0.0-alpha.68
  • @expo/next-adapter@3.1.17

Do you have any idea how to debug this?

@karlsander karlsander changed the title Problems running with next.js HookWebpackError when running with next.js Mar 4, 2022
@natew
Copy link
Member

natew commented Mar 13, 2022

If it's at all possible to strip it down to a small example repo that would help a lot. I haven't tested it with withExpo but could debug from there.

@karlsander
Copy link
Author

Yes, happy to do that. Crazy busy week for me, so it will be next week, but I'm very much looking forward to solving this and being able to actually utilize tamagui.

@natew
Copy link
Member

natew commented May 17, 2022

Lots of fixes have landed since, may want to update and check again.

@natew natew closed this as completed May 18, 2022
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

2 participants