jasononeil / webpack-haxe-loader

Webpack loader for the Haxe programming language.
MIT License
38 stars 11 forks source link

can you give a example project use in vue? #56

Open sonygod opened 5 years ago

sonygod commented 5 years ago

can you give a example project use webpack-haxe-loader in vue?

elsassph commented 5 years ago

Good idea.

Did you try VueHx (https://github.com/DenkiYagi/vuehx) without Webpack first? It doesn't need Webpack at all.

Or do you want to use the official Vue plugin because you'd like to include some Haxe code in a wider Vue project?

sonygod commented 5 years ago

I need to use in real vue dev with Vue CLI 3.4.1

I 'd like to include some haxe code inside Vue project,

@elsassph

by the way ,I also want to try [hxgenjs](https://github.com/kevinresol/hxgenjs) with Vue,

elsassph commented 5 years ago

You can use either Webpack Haxe Loader or hxgenjs, but not together.

Also do you want to interop JS-side Vue components and Haxe side Vue components? Or just include some special content using Haxe (considering your Heaps-related question)?

sonygod commented 5 years ago

I try to use Heaps engine in Vue-cli, but it's too big to build every time ,so I want to choose hxgenjs to

reduce js size suit for hot reload.but it's not work

and I want to use your webpack-haxe-loader for debug only in hx files.

elsassph commented 5 years ago

Are you trying to use Heaps as renderer for Vue? Or just render a non-Vue piece using Heaps?

In the second case, if you don't want to build it often it's indeed a good idea to just build it separately, and even load it lazily.

vrescobar commented 5 years ago

Hi @sonygod I had the same problem and I ended up forking the repo in order to create the simplest webpack loader for haxe. I use personally use for Vue as well so it includes an example of config for it.

https://github.com/vrescobar/webpack-haxe-loader

Since it contains just the minimum amount of features, now it might be trivial to modify the loader to support other variants which deviates from haxe's original behave.

elsassph commented 5 years ago

@vrescobar the changes you have done seem rather significant so you should consider renaming your fork to avoid confusion if it's not meant to be compatible, or work with us to fix your issues while keeping the expected functionality.

vrescobar commented 5 years ago

thanks for the suggestion, I ended up renaming to: https://github.com/vrescobar/webpack-simple-haxe-loader

Actually, I wanted to ask you, why so much work modifying the args and splitting the code? Supposedly haxe will just remove unused code with DCE.

elsassph commented 5 years ago

I agree splitting is a relatively complex feature and it should be possible to completely skip it for small bits of Haxe, but it's not about unused code, it's about reducing the initial JS payload. https://webpack.js.org/guides/code-splitting/