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

Next.js doesn't work with js-sdk #198

Closed
ilya-korotya opened this issue Mar 19, 2024 · 7 comments
Closed

Next.js doesn't work with js-sdk #198

ilya-korotya opened this issue Mar 19, 2024 · 7 comments
Assignees
Labels
bug Something isn't working stale

Comments

@ilya-korotya
Copy link
Contributor

ilya-korotya commented Mar 19, 2024

Describe the bug
I used next.js together with the js-sdk at the time of development, everything worked fine, but after I built the frontend for production, I got the error "buildBatchConversion$3 not found"

To Reproduce
Init next.js project and integrate js-sdk.

Environment info (please complete the following information):

  • OS version Mac OS 14.3.1
  • Node version: 20.11.1
  • Browser: chrome
  • Package version 1.9.X
@ilya-korotya ilya-korotya added the bug Something isn't working label Mar 19, 2024
@Kolezhniuk
Copy link
Collaborator

@ilya-korotya for now you could apply patch ffjavascript+0.2.63.patch until PR will be merged

diff --git a/node_modules/ffjavascript/build/browser.esm.js b/node_modules/ffjavascript/build/browser.esm.js
index 439dcfd..fb9caae 100644
--- a/node_modules/ffjavascript/build/browser.esm.js
+++ b/node_modules/ffjavascript/build/browser.esm.js
@@ -2757,10 +2757,6 @@ class EC {
 
 }
 
-function getDefaultExportFromCjs (x) {
-	return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
-}
-
 var utils$6 = {};
 
 /*
@@ -15646,26 +15642,6 @@ function thread(self) {
     return runTask;
 }
 
-/**
- * Copyright 2020 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var browser = Worker;
-
-var Worker$1 = /*@__PURE__*/getDefaultExportFromCjs(browser);
-
 /*
     Copyright 2019 0KIMS association.
 
@@ -15772,7 +15748,7 @@ async function buildThreadManager(wasm, singleThread) {
 
         for (let i = 0; i<concurrency; i++) {
 
-            tm.workers[i] = new Worker$1(workerSource);
+            tm.workers[i] = new Worker(workerSource);
 
             tm.workers[i].addEventListener("message", getOnMsg(i));
 

@ilya-korotya
Copy link
Contributor Author

The same error for "@0xpolygonid/js-sdk": "^1.10.4"

main-96fef91174c5d34a.js:1 Uncaught (in promise) ReferenceError: buildBatchConvertion$3 is not defined

@Kolezhniuk
Copy link
Collaborator

Sorry, needs to wait until ffjavascript package will be published and then js-sdk will publish version update with fixes

@ilya-korotya
Copy link
Contributor Author

@Kolezhniuk thanks for your help in testing, but the version of ffjavascript with the fix doesn't work

@Kolezhniuk
Copy link
Collaborator

Kolezhniuk commented Apr 12, 2024

Ok, @ilya-korotya, the solution for this is to turn off flag splitChunks in the next.config.js

module.exports = {
  // ...
  optimization: {
    splitChunks: false,
  },
  // ...
};

Thanks for collaboration!

Copy link

This issue is stale because it has been open for 14 days with no activity.

@github-actions github-actions bot added the stale label Apr 27, 2024
Copy link

This issue was closed because it has been inactive for 7 days since being marked as stale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale
Projects
None yet
Development

No branches or pull requests

3 participants