赞
踩
npm install babel-plugin-component -D
or
yarn add babel-plugin-component
.babelrc
添加以下代码
- {
- "presets": [["es2015", { "modules": false }]],
- "plugins": [
- [
- "component",
- {
- "libraryName": "element-ui",
- "styleLibraryName": "theme-chalk"
- }
- ]
- ]
- }
- {
- "presets": [["@babel/preset-env", { "modules": false }]],
- "plugins": [
- [
- "component",
- {
- "libraryName": "element-ui",
- "styleLibraryName": "theme-chalk"
- }
- ]
- ]
- }
注意:.babelrc 的配置项,可以写入到 babel.config.js 文件中,之后不再需要 .babelrc 文件了。
因为 .babelrc 文件是旧版本的脚手架才有的,新版本是 babel.config.js 文件。
- module.exports = {
- presets: [
- '@vue/cli-plugin-babel/preset',
- ["@babel/preset-env", { "modules": false }]
- ],
- "plugins": [
- [
- "component",
- {
- "libraryName": "element-ui",
- "styleLibraryName": "theme-chalk"
- }
- ]
- ]
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。