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 Cannot get final name for export 'transposeImplCPU' error #8235

Open
FlyingTurkman opened this issue Apr 9, 2024 · 2 comments
Open

Comments

@FlyingTurkman
Copy link

I am trying to build a next js app includes tensorflow.js but an error has occured.

Creating an optimized production build ...
Failed to compile.

./node_modules/@tensorflow/tfjs-backend-webgl/dist/register_all_kernels.js + 256 modules
Cannot get final name for export 'transposeImplCPU' of ./node_modules/@tensorflow/tfjs-backend-webgl/dist/kernels/Transpose_impl.js

Build failed because of webpack errors

Tensorflow versions:
"@tensorflow/tfjs": "^4.17.0",
"@tensorflow/tfjs-core": "^4.17.0",

Code

import * as tf from '@tensorflow/tfjs'
import '@tensorflow/tfjs'
import '@tensorflow/tfjs-backend-webgl'

Also when I tried deploy to vercel same error occured.

@gaikwadrahul8
Copy link
Contributor

Hi, @FlyingTurkman

I apologize for the delayed response and thank you for bringing this issue to our attention, as far I know that error typically arises due to a Webpack configuration issue during the build process so may be Webpack's tree-shaking functionality might be causing problems. Try disabling it for the TensorFlow.js packages If you're comfortable with a potential increase in bundle size and want a quick solution, disabling tree-shaking globally might solve this issue and please refer official documentation of Generating size-optimized browser bundles with TensorFlow.js, if possible please give it try with Rollup might have better compatibility with TensorFlow.js:

// webpack.config.js
module.exports = {
  // ... other configurations
  optimization: {
    minimize: true,
    sideEffects: false, // Disable tree-shaking for TensorFlow.js packages
  },
};

If I have missed something here please let me know. Thank you for your cooperation and patience.

@FlyingTurkman
Copy link
Author

Hi, @FlyingTurkman

I apologize for the delayed response and thank you for bringing this issue to our attention, as far I know that error typically arises due to a Webpack configuration issue during the build process so may be Webpack's tree-shaking functionality might be causing problems. Try disabling it for the TensorFlow.js packages If you're comfortable with a potential increase in bundle size and want a quick solution, disabling tree-shaking globally might solve this issue and please refer official documentation of Generating size-optimized browser bundles with TensorFlow.js, if possible please give it try with Rollup might have better compatibility with TensorFlow.js:

// webpack.config.js
module.exports = {
  // ... other configurations
  optimization: {
    minimize: true,
    sideEffects: false, // Disable tree-shaking for TensorFlow.js packages
  },
};

If I have missed something here please let me know. Thank you for your cooperation and patience.

Thank you for response but not working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants