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

How to config opencascade.js in next.js? #263

Open
Flyingbeanss opened this issue Oct 18, 2023 · 1 comment
Open

How to config opencascade.js in next.js? #263

Flyingbeanss opened this issue Oct 18, 2023 · 1 comment

Comments

@Flyingbeanss
Copy link

Flyingbeanss commented Oct 18, 2023

I consulted the configuration tutorial in here.But when I tried to import it, something went wrong.

My code

import initOpenCascade from "opencascade.js";

initOpenCascade().then(oc => {
  // Check out the examples on how to use this library!
});

Error
image

Maybe there is something wrong in the next.config.js?
My config

/** @type {import('next').NextConfig} */


module.exports = {
    transpilePackages: ['three'],
    webpack: (config, { isServer }) => {
        config.module.rules.push({
            test: /\.wasm$/,
            type: "javascript/auto",
            loader: "file-loader"
        });
        config.resolve.fallback = {
            ...config.resolve.fallback,
            fs: false,
            perf_hooks: false,
            os: false,
            worker_threads: false,
            crypto: false,
            stream: false,
        };

        return config;
    },
}

Can anyone help me? Thanks :).

@Flyingbeanss
Copy link
Author

I copy the config of config-overrides.js into the next.config.js, it worked!
But I don't know why.
Shouldn't next.js use webpack instead of create-react-app?

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

1 participant