apache / incubator-weex-loader

Apache License 2.0
65 stars 32 forks source link

[Proposal] A more robust way to distinguish the type of the bundle #37

Closed Hanks10100 closed 7 years ago

Hanks10100 commented 7 years ago

weex-loader support both Weex and Vue now, it should also offer a way to distinguish the bundle type.

Currently, Weex is using a banner comment to distinguish the type of the bundle, and find the corresponding framework to create instance. It's neither elegant nor robust.

I think we should offer a function (e.g. getWeexBundleType) or a global variable (e.g. WEEX_BUNDLE_TYPE) to get the type of current bundle.

Jinjiang commented 7 years ago

The current way has the best perf and simplicity. The type detection will be done before the JS bundle executed. No chance to run a function or get value for a global variable.