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

Package Fails with NextJS in Production #11

Open
Loque18 opened this issue Jul 10, 2023 · 2 comments
Open

Package Fails with NextJS in Production #11

Loque18 opened this issue Jul 10, 2023 · 2 comments

Comments

@Loque18
Copy link

Loque18 commented Jul 10, 2023

The application works fine in the development environment (localhost) but fails when deployed in production.

this is the error

image

it seems that is related to nekoton_wasm package, for some reason the wasm file couldn´t be loaded into the built files

@Rexagon
Copy link
Member

Rexagon commented Jul 10, 2023

Please make sure that all files are included in the production bundle. As I mentioned in #8 (comment) you might need to use a wasm-loader

@Loque18
Copy link
Author

Loque18 commented Jul 15, 2023

Please make sure that all files are included in the production bundle. As I mentioned in #8 (comment) you might need to use a wasm-loader

Hello @Rexagon thanks for the fast reply I found a workaround, first I searched for the nekotom_wasm_bg.wasm file on the nekotom package, then I copied it to the root of the project

and I copied the file to the folder with help of copy-wepback-plugin library, I had to add the following to my NextJS config

const CopyPlugin = require("copy-webpack-plugin");
const path = require("path");

const nextConfig = {
  webpack: (config, { isServer }) => {
    if (isServer) {
      config.plugins.push(
        new CopyPlugin({
          patterns: [
            {
              from: path.resolve(__dirname, "./nekoton_wasm_bg.wasm"),
              to: path.resolve(
                __dirname,
                ".next/server/chunks/nekoton_wasm_bg.wasm",
              ),
            },
          ],
        }),
      );
    }

    return config;
  },
};

module.exports = nextConfig;

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