Open dimar-hanung opened 2 years ago
It is a bug when working with vue-cli
.
@babel/plugin-transform-typeof-symbol
from @vue/cli-plugin-babel/preset
// babel.config.js
module.exports = {
presets: [
[
'@vue/cli-plugin-babel/preset',
{
exclude: [
'@babel/plugin-transform-typeof-symbol'
]
}
]
],
}
// babel.config.js
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
],
exclude: 'VueTemplateBabelCompiler'
}
This compiler take the @vue/cli-plugin-babel/preset
as a babel preset by default.
So the typeof
keyword is transformed into:
var _typeof = require(".../node_modules/@babel/runtime/helpers/typeof")
// your code...
_typeof example
It is unexpected.
May be we can ignore the default babel.config.js
of vue-cli
.
Do you have interest to fix this issue? You can:
Try to reproduce this code snippet and error by setup DEMO Project.
Follow CONTRIBUTING.md to make a Pull Request.
Thanks for solution and explanation , it's work after exclude '@babel/plugin-transform-typeof-symbol'
Version
What is expected?
Can call typeof in template
What is actually happening?
Return
ReferenceError: _typeof is not defined
Steps to Reproduce