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

ace: worker loaders are not used #5464

Open
sherlock1982 opened this issue Jan 15, 2024 · 1 comment
Open

ace: worker loaders are not used #5464

sherlock1982 opened this issue Jan 15, 2024 · 1 comment

Comments

@sherlock1982
Copy link

Describe the bug

esm-resolver.js file has the following line to load worker-xml:

ace.config.setModuleLoader('ace/mode/xml_worker', () => import('./src-noconflict/worker-xml.js'));

This code is not used for workers (but works for the other modules)

Expected Behavior

worker-xml should be loaded from a specified webpack-module

Current Behavior

worker-xml.js is still loaded

Reproduction Steps

Load modules like this in Webpack5 project:

  import { Ace, edit, config } from 'ace-builds';
  import 'ace-builds/esm-resolver';

You will notice that all modules are properly loaded but workers will fail with 404

Possible Solution

As a workaround you can still use:

    import xmlWorkerUrl from 'file-loader!ace-builds/src-noconflict/worker-xml';
    config.setModuleUrl('ace/mode/xml_worker', xmlWorkerUrl);

Additional Information/Context

The issue is somewhere inside $createWorkerFromOldConfig. It uses config.moduleUrl(mod, "worker") to get workerUrl. But actually it should refer to dynamicModules somehow

Ace Version / Browser / OS / Keyboard layout

1.32.3

@sherlock1982
Copy link
Author

sherlock1982 commented Jan 15, 2024

I think I understand what is the problem here.
You can't use worker loaders because you specifically need worker-url to construct blob-worker. String is needed here.
Maybe you can simply use worker loader directly? Without using a blob?

I see that UIWorkerClient kind of does it but it looks like this function is not used at all. Only WorkerClient is used

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