apache / incubator-weex-loader

Apache License 2.0
65 stars 32 forks source link

update component name generate method #48

Closed dickeylth closed 7 years ago

dickeylth commented 7 years ago

In case weex page is composed by separate weex component jsbundles whose entry filename are index.we, which makes every bundle compiles as:

__weex_define__('@weex-component/f5e1c456d74a6374b2c0129d79c108e1', [], function(__weex_require__, __weex_exports__, __weex_module__) {

    __weex_script__(__weex_module__, __weex_exports__, __weex_require__)
    if (__weex_exports__.__esModule && __weex_exports__.default) {
        __weex_module__.exports = __weex_exports__.default
    }

    __weex_module__.exports.template = __weex_template__

     __weex_module__.exports.style = __weex_style__

})

__weex_bootstrap__('@weex-component/f5e1c456d74a6374b2c0129d79c108e1',undefined,undefined)

As shown above, md5('index.we') === "f5e1c456d74a6374b2c0129d79c108e1".

So this commit suggests to generate component name based on file content instead of file name to avoid this problem.