Closed bigmeow closed 5 years ago
当不写index.js时,megalo-target的vue-entry会自动生成并注入部分index.js的代码:
import Component from ${ JSON.stringify( '-!' + remainingRequest ) }; import Vue from 'vue'; Component.mpType = "${ entryKey === 'app' ? 'app' : 'page' }"; const app = new Vue(Component); app.$mount()
代码地址:https://github.com/kaola-fed/megalo-aot/blob/03ef02b9d16f29f8822551e2a2e52c0894c5512e/packages/target/lib/frameworks/vue/loader/vue-entry.js
以aot中的demo为例,当编译后,打开dist目录下,找到生成后的js页面文件dist/package/static/js/package/pages/demo/index.js,在文件中搜索'const',可以看到下面的代码:
dist/package/static/js/package/pages/demo/index.js
_Users_bigMeow_GitHub_megalo_megalo_aot_examples_vue_mp_node_modules_vue_loader_lib_index_js_vue_loader_options_Users_bigMeow_GitHub_megalo_megalo_aot_examples_vue_mp_src_package_pages_demo_index_vue__WEBPACK_IMPORTED_MODULE_0__["default"].mpType = "page"; const app = new vue__WEBPACK_IMPORTED_MODULE_1___default.a(_Users_bigMeow_GitHub_megalo_megalo_aot_examples_vue_mp_node_modules_vue_loader_lib_index_js_vue_loader_options_Users_bigMeow_GitHub_megalo_megalo_aot_examples_vue_mp_src_package_pages_demo_index_vue__WEBPACK_IMPORTED_MODULE_0__["default"]); app.$mount();
这里有两个问题:
UglifyJsPlugin 压缩混淆时会报错
Unexpected token: keyword (const)
暂时先这么解决了 https://github.com/kaola-fed/megalo-aot/pull/62/files
@megalo/target@0.6.2
问题描述
当不写index.js时,megalo-target的vue-entry会自动生成并注入部分index.js的代码:
代码地址:https://github.com/kaola-fed/megalo-aot/blob/03ef02b9d16f29f8822551e2a2e52c0894c5512e/packages/target/lib/frameworks/vue/loader/vue-entry.js
以aot中的demo为例,当编译后,打开dist目录下,找到生成后的js页面文件
dist/package/static/js/package/pages/demo/index.js
,在文件中搜索'const',可以看到下面的代码:这里有两个问题:
造成的影响
UglifyJsPlugin 压缩混淆时会报错