Skip to content

support with cloudflare workers #1007

@juanpablocs

Description

@juanpablocs

💬 Questions and Help

Nowadays, when generating a build for production, the NextJS rule doesn't apply. The SVG ends up being generated as an asset when I expect an inline component.

/** @type {import('next').NextConfig} */
const nextConfig = {
  turbopack: {
    rules: {
      '*.svg': {
        loaders: ['@svgr/webpack'],
        as: '*.js',
      },
    },
  },
};

export default nextConfig;
// added by create cloudflare to enable calling `getCloudflareContext()` in `next dev`
import { initOpenNextCloudflareForDev } from '@opennextjs/cloudflare';
initOpenNextCloudflareForDev();

usage component working on local with node

import PersonalizedIcon from "../assets/svg/personalizate.svg"
<PersonalizedIcon />

error result with cloudflare workers:

 Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions