Storybook Vue Duplicate declaration "h"错误 ?
ERROR in ./src/components/nav-menu/NavMenu.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
TypeError: /Users/codeme/workspace/storybook-demo/src/components/nav-menu/NavMenu.js: Duplicate declaration "h" (This is an error on an internal node. Probably an internal error.)
at File.buildCodeFrameError (/Users/codeme/workspace/storybook-demo/node_modules/@babel/core/lib/transformation/file/file.js:262:12)
at Scope.checkBlockScopedCollisions (/Users/codeme/workspace/storybook-demo/node_modules/@babel/traverse/lib/scope/index.js:344:22)
at Scope.registerBinding (/Users/codeme/workspace/storybook-demo/node_modules/@babel/traverse/lib/scope/index.js:501:16)
at Scope.registerDeclaration (/Users/codeme/workspace/storybook-demo/node_modules/@babel/traverse/lib/scope/index.js:441:14)
at Object.BlockScoped (/Users/codeme/workspace/storybook-demo/node_modules/@babel/traverse/lib/scope/index.js:187:28)
at Object.newFn (/Users/codeme/workspace/storybook-demo/node_modules/@babel/traverse/lib/visitors.js:230:17)
at NodePath._call (/Users/codeme/workspace/storybook-demo/node_modules/@babel/traverse/lib/path/context.js:53:20)
at NodePath.call (/Users/codeme/workspace/storybook-demo/node_modules/@babel/traverse/lib/path/context.js:36:14)
at NodePath.visit (/Users/codeme/workspace/storybook-demo/node_modules/@babel/traverse/lib/path/context.js:88:12)
at TraversalContext.visitQueue (/Users/codeme/workspace/storybook-demo/node_modules/@babel/traverse/lib/context.js:118:16)
at TraversalContext.visitMultiple (/Users/codeme/workspace/storybook-demo/node_modules/@babel/traverse/lib/context.js:85:17)
at TraversalContext.visit (/Users/codeme/workspace/storybook-demo/node_modules/@babel/traverse/lib/context.js:144:19)
at Function.traverse.node (/Users/codeme/workspace/storybook-demo/node_modules/@babel/traverse/lib/index.js:94:17)
at NodePath.visit (/Users/codeme/workspace/storybook-demo/node_modules/@babel/traverse/lib/path/context.js:95:18)
at TraversalContext.visitQueue (/Users/codeme/workspace/storybook-demo/node_modules/@babel/traverse/lib/context.js:118:16)
at TraversalContext.visitSingle (/Users/codeme/workspace/storybook-demo/node_modules/@babel/traverse/lib/context.js:90:19)
@ ./src/components/nav-menu/NavMenu.stories.js 3:0-32 22:15-22
@ ./src sync \.stories\.js$
@ ./.storybook/config.js
@ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./.storybook/config.js ./node_modules/webpack-hot-middleware/client.js?reload=true
package.json
{
"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"
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 vue-cli@3 + storybook@5 的条件下,解决了这个问题
在
.storybook
目录下新建文件.babelrc
,内容如下: