Next.js Discord

Discord Forum

Turbopack Geojson

Unanswered
Transvaal lion posted this in #help-forum
Open in Discord
Transvaal lionOP
I wonder how I can migrate from webpack rules to turbopack with geojson?

my current next.config.js:
  turbopack: {
    rules: {
      // https://github.com/vercel/next.js/discussions/50337#discussioncomment-12786467
      "*.svg": {
        loaders: [
          {
            loader: "@svgr/webpack",
            options: {
              svgoConfig: {
                plugins: [
                  {
                    name: "preset-default",
                    params: {
                      overrides: {
                        // customize default plugin options
                        removeViewBox: false,
                      },
                    },
                  },
                  "removeDimensions",
                ],
              },
            },
          },
        ],
        as: "*.js",
      },
      "*.geojson": {
        loaders: [],
        type: "json",
      },
    },
    resolveExtensions: [".mdx", ".tsx", ".ts", ".jsx", ".js", ".mjs", ".json"],
  },
  webpack(config) {
    config.module.rules.push({
      test: /\.svg$/,
      use: ["@svgr/webpack"],
    });

    config.module.rules.push({
      test: /\.geojson$/,
      type: "json",
    });

    return config;
  },


Error:

./lib/map/geodata.geojson

Unknown module type
This module doesn't have an associated type. Use a known file extension, or register a loader for it.

Read more: https://nextjs.org/docs/app/api-reference/next-config-js/turbo#webpack-loaders

0 Replies