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

Issues in Next.js 14 #423

Open
AlfieDarko opened this issue Jan 26, 2024 · 3 comments
Open

Issues in Next.js 14 #423

AlfieDarko opened this issue Jan 26, 2024 · 3 comments

Comments

@AlfieDarko
Copy link

AlfieDarko commented Jan 26, 2024

Getting some issues trying to use react95 in nextjs 14.

This is what I see in the terminal and localhost:3000

 ⨯ ./Cursor:37
Error: Image import "./cursors/AngleUpLeft.png" is not a valid image file. The image may be corrupted or an unsupported format.
Screenshot 2024-01-26 at 20 25 15

.

Im wondering if it has something to do with the loaders? Next shouldnt have a problem with this at all but I've been stuck for days without a resolution.

Here is the next config I am using

const withTM = require("next-transpile-modules")([
  "@react95/icons",
  "@react95/core",
]); // Add '@react95/icons' to the transpile modules list
const withFonts = require("next-fonts");
const path = require("path");
const withImages = require("next-images");

// next.config.js
module.exports = withImages(
  withFonts(
    withTM({
      webpack: (config, { isServer, defaultLoaders }) => {
        if (!isServer) {
          // Adjust the client-side Webpack configuration
          config.module.rules.push({
            test: /\.svg$/,
            include: [path.resolve(__dirname, "node_modules/@react95")],
            use: ["@svgr/webpack"],
          });

          config.module.rules.push({
            test: /\.(svg|woff|woff2|ttf|eot|ico)$/,
            use: [
              {
                loader: "file-loader?name=assets/[name].[hash].[ext]",
                options: {
                  name: "[name].[ext]", // You can adjust the naming convention
                  publicPath: "/_next/static/fonts/", // The path where the fonts will be served from
                  outputPath: "static/fonts/", // The path where the fonts will be outputted
                },
              },
            ],
          });

          config.module.rules.push({
            test: /\.(png|jpe?g|gif)$/,
            include: [path.resolve(__dirname, "node_modules/@react95")],
            use: {
              loader: "file-loader",
              options: {
                publicPath: "/_next/static/images/",
                outputPath: "static/images/",
                name: "[name]-[hash].[ext]",
              },
            },
          });
        }

        return config;
      },
    })
  )
);

Any help is appreciated!

ggdaltoso added a commit that referenced this issue Mar 7, 2024
changing from `styled-components` to `vanilla-extract`

BREAKING CHANGE: React95 now changes its styling core, from `styled-components`/`xstyled` to
`vanilla-extract`. This will change how the lib is installed and how to use the components

re #423, re #407
@flexchapman
Copy link

@ggdaltoso is your branch able to be merged? I'm experiencing the same issue.

@ggdaltoso
Copy link
Member

I'm aiming to ship this week, @flexchapman

Stay tuned!

@flexchapman
Copy link

Love it! Many thanks.

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