目前文档里:
https://vuecomponent.github.io/ant-design-vue/docs/vue/use-with-vue-cli/#Advanced-Guides
这里还是.babelrc的示例,而不是babel.config.js
其实我能猜到差不多类似的配置,但还是希望能有一个babel.config.js的示例代码
谢谢
这些个前端工具的配置,真是折磨死人了
babel.config.js
遇到同样的问题,导致如果完全按照官方文档的命令行去安装一开始就报错,无法使用了。
感觉组织人力跟不上啊
是的呀 欢迎pr 😀
我就是因为不会玩babel,才请求官方给一个示例代码的啊
哈哈
根据测试,babel.config.js的内容应该是
module.exports = {
presets: [
'@vue/app'
],
"plugins": [
["import", {
"libraryName": "ant-design-vue",
"libraryDirectory": "es", "style": "css"
}]
]
}
babel.config.js
module.exports = {
presets: [
'@vue/app'
],
plugins: [
[
"import",
{
"libraryName": "ant-design-vue",
"libraryDirectory": "es",
"style": "css"
}
]
]
}
package.json中“dependencies,devDependencies”中示列代码如下
"dependencies": {
"ant-design-vue": "^1.1.7",
"vue": "^2.5.17",
"vue-router": "^3.0.1"
},
"devDependencies": {
"@babel/cli": "^7.1.2",
"@babel/core": "^7.1.2",
"@vue/cli-plugin-babel": "^3.0.5",
"@vue/cli-plugin-eslint": "^3.0.5",
"@vue/cli-service": "^3.0.5",
"babel-plugin-import": "^1.11.0",
"vue-template-compiler": "^2.5.17"
}
这样就可以按需引入ant-design-vue的组件了
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
根据测试,babel.config.js的内容应该是
module.exports = { presets: [ '@vue/app' ], "plugins": [ ["import", { "libraryName": "ant-design-vue", "libraryDirectory": "es", "style": "css" }] ] }