-
Notifications
You must be signed in to change notification settings - Fork 417
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.vue文件打包后 const 等es6 语法未被babel转换 #29
Comments
es6 未转换代码来源有两个部分: .vue 文件需要通过 babel 处理
如下类似代码: /* style */
const __vue_inject_styles__ = undefined;
/* scoped */
const __vue_scope_id__ = undefined;
/* module identifier */
const __vue_module_identifier__ = undefined;
/* functional template */
const __vue_is_functional_template__ = false; 解决: babel({
exclude: /node_modules\/(?!(@lljj)\/).*/,
extensions: ['.js', '.vue'], // + .vue 文件
}) 参考:rollup/rollup-plugin-babel#260 vue runtime helper 转换后的代码存在 const,如下
如下类似代码: function normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier /* server only */, shadowMode, createInjector, createInjectorSSR, createInjectorShadow) {
if (typeof shadowMode !== 'boolean') {
createInjectorSSR = createInjector;
createInjector = shadowMode;
shadowMode = false;
}
// Vue.extend constructor export interop.
const options = typeof script === 'function' ? script.options : script;
}
} 解决: vue({
normalizer: '~vue-runtime-helpers/dist/normalize-component.js'
}) |
lljj-x
changed the title
lib中存在 const 等es6 语法未被babel转换
.vue文件打包后 const 等es6 语法未被babel转换
Jan 18, 2021
lljj-x
added a commit
that referenced
this issue
Jan 18, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
lib中存在 const 等es6 语法未被babel转换
看起来像 vue plugin 生成的
The text was updated successfully, but these errors were encountered: