haxe-modular icon indicating copy to clipboard operation
haxe-modular copied to clipboard

Issue with vshaxe / compilation server?

Open mockey opened this issue 1 year ago • 4 comments

I tried modular for a very simple code splitting setup. Pure haxe and I just want one class splitted into a separate file. Worked nicely withBundle.load. But when I compile again from vshaxe (default task) the code is not splitted anymore. I get one complete file then. When I try haxe build.hxml from the command line it works. So I thought it might have to do with the compilation server or cache. Adding "haxe.enableCompilationServer": false to a settings.json makes code splitting work every time. Is this a known issue? Also -D js-es=6 seems to mandatory for loading files. Is this correct?

mockey avatar Mar 23 '23 19:03 mockey

Would you have a sample project or just paste the task definition? Splitting is done post-build with a NodeJS script which may fail to run in this case - it can also be disabled with -D modular_stub.

-D js-es=6 shouldn't be required

elsassph avatar Apr 01 '23 08:04 elsassph

Well, as I wrote: splitting generally works well, I see the output:

AST processed in: 28ms
Bundling...
Graph processed in: 2ms
Emit ..../script-1.js
Emit ..../script-2.js
Write ..../script-1.js
Write ..../script-2.js

But when I compile a second time without changing anything and using default build task from vshaxe, I only get:

Emit ..../script-1.js
Write ..../script-1.js

So no more splitting. If I change something in the code splitting works again.

I think by default vshaxe uses the compilation server for building that is also used for code completion and caching. If I switch that off with "haxe.enableCompilationServer": false, splitting works reliably every time. So no big deal actually, I was just wondering if this might be a known issue. I could try that with a sample project maybe.

You're right about -D js-es=6, though. Don't know what I saw there.

Thanks for making this tool available. Are you still using it yourself as well?

mockey avatar Apr 03 '23 16:04 mockey

So second time does the JS output look complete? e.g. just not split?

Unfortunately I don't use it much myself anymore... Job doesn't include any Haxe now.

elsassph avatar Apr 05 '23 15:04 elsassph

Yes, exactly. First build: two split files. Second build (without changing anything): one complete (and working) js file.

With "haxe.enableCompilationServer": false (in .vscode/settings.json) always two split files (compilation takes a little longer, though).

mockey avatar Apr 13 '23 11:04 mockey