image.png

配置如下:

{
  "name": "storybook-demo",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint",
    "build-storybook": "build-storybook",
    "storybook": "start-storybook -p 6006",
    "storybook:build": "vue-cli-service storybook:build -c config/storybook",
    "storybook:serve": "vue-cli-service storybook:serve -p 6006 -c config/storybook",
    "test:unit": "vue-cli-service test:unit"
  },
  "dependencies": {
    "core-js": "^2.6.5",
    "element-ui": "^2.11.1",
    "vue": "^2.6.10"
  },
  "devDependencies": {
    "@babel/core": "^7.5.5",
    "@storybook/addon-actions": "^5.1.11",
    "@storybook/addon-knobs": "^4.1.0 || ^5.0.0",
    "@storybook/addon-links": "^5.1.11",
    "@storybook/addon-notes": "^4.1.0 || ^5.0.0",
    "@storybook/addons": "^5.1.11",
    "@storybook/vue": "^5.1.11",
    "@vue/cli-plugin-babel": "^3.10.0",
    "@vue/cli-plugin-eslint": "^3.10.0",
    "@vue/cli-plugin-unit-jest": "^3.10.0",
    "@vue/cli-service": "^3.10.0",
    "@vue/eslint-config-prettier": "^5.0.0",
    "@vue/test-utils": "1.0.0-beta.29",
    "babel-core": "7.0.0-bridge.0",
    "babel-eslint": "^10.0.1",
    "babel-jest": "^23.6.0",
    "babel-loader": "^8.0.6",
    "babel-preset-vue": "^2.0.2",
    "eslint": "^5.16.0",
    "eslint-plugin-prettier": "^3.1.0",
    "eslint-plugin-vue": "^5.0.0",
    "prettier": "^1.18.2",
    "vue-cli-plugin-storybook": "^0.6.1",
    "vue-template-compiler": "^2.6.10"
  }
}


发布于 2020-10-10 12:41
共1个回答
XL
游客xlRpUN

在 vue-cli@3 + storybook@5 的条件下,解决了这个问题

在 .storybook 目录下新建文件 .babelrc,内容如下:



{ "presets": [ "@vue/app" ] }
回答问题