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

Webpack: error for missing modules in WASM version #141

Open
2 of 9 tasks
daFish opened this issue Apr 9, 2024 · 1 comment
Open
2 of 9 tasks

Webpack: error for missing modules in WASM version #141

daFish opened this issue Apr 9, 2024 · 1 comment

Comments

@daFish
Copy link

daFish commented Apr 9, 2024

What is the issue about?

  • Bug
  • Feature request
  • Usage question
  • Documentation
  • Contributing / Development

What part(s) of Essentia.js is involved?

  • essentia.js-core (vanilla algorithms)
  • essentia.js-model (machine learning algorithms)
  • essentia.js-plot (plotting utility module)
  • essentia.js-extractor (typical algorithm combinations utility)

Description

I'm using webpack to bundle my scripts and I get the following warning/errors:

Module build failed: Module not found:
"./node_modules/essentia.js/dist/essentia-wasm.es.js" contains a reference to the file "crypto".
This file can not be found, please check it for typos or update it if the file got moved.

 ERROR  Failed to compile with 2 errors                                                                                                                                                                                            12:06:27

Module build failed: Module not found:
"./node_modules/essentia.js/dist/essentia-wasm.es.js" contains a reference to the file "path".
This file can not be found, please check it for typos or update it if the file got moved.

"./node_modules/essentia.js/dist/essentia-wasm.es.js" contains a reference to the file "fs".
This file can not be found, please check it for typos or update it if the file got moved.

Is there anything I can do to prevent such an error? Note: The script is working however.

Steps to reproduce / Code snippets / Screenshots

Small sample script:

import Essentia from 'essentia.js/dist/essentia.js-core.es';
import { EssentiaWASM } from 'essentia.js/dist/essentia-wasm.es.js';

export default class EssentiaProcessor {
    essentia: Essentia;

    constructor() {
        this.essentia = new Essentia(EssentiaWASM, process.env.NODE_ENV === 'development');
    }
}

System info

  • essentia.js-Version: 0.1.3
  • Webpack: 5.74.0
  • NodeJS: v21.7.2
@daFish
Copy link
Author

daFish commented Apr 9, 2024

After some more research I found a solution(?). The errors are caused by the WASM integration and the configuration of the following experiments in my webpack.config.js:

module.exports = {
  //...
    experiments = {
        asyncWebAssembly: true,
        futureDefaults: true,
        lazyCompilation: true,
        outputModule: true,
        syncWebAssembly: true,
    }
};

I'll test this further and report, when I find issues.

Update: Nevermind, doesn't work.

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