2
현재 vue.js 프로젝트를 nuxt.js로 변환하려고합니다. nuxt.js에 flowtype 지원을 추가 할 수 없습니다. 내가 흐름 서버를 실행할 때 오류가 없다고 !! npm을 실행하면 dev를 실행하고 흐름 구문에서 throwing 오류가 발생합니다.Nuxt.js에서 flowtype을 구현하는 방법
.flowconfig
[include]
pages/**/.*
components/**/.*
layouts/**/.*
apiRoutes/.*
store/.*
utils/.*
[ignore]
.*/build/.*
.*/config/.*
.*/dist/.*
.*/node_modules/.*
.*/static/.*
.*/test/.*
.*/ssl/.*
.*/.nuxt/.*
[libs]
./flow/
[options]
emoji=true
module.file_ext=.vue
module.file_ext=.js
server.max_workers=3
log.file=./flow.log
suppress_comment= \\(.\\|\n\\)*\\$FlowFixMe
unsafe.enable_getters_and_setters=true
module.system.node.resolve_dirname=node_modules
module.name_mapper='^.*\.css$' -> 'empty/object'
module.name_mapper='^.*\.js$' -> 'empty/object'
module.name_mapper='^@/\(.*\)$' -> '<PROJECT_ROOT>/\1'
필자는 모든 babel 및 eslint 패키지를 추가했습니다. 실행 NPM 실행 디바이스에
.eslintrc.js
module.exports = {
root: true,
parserOptions: {
parser: 'babel-eslint',
sourceType: 'module'
},
env: {
browser: true,
node: true,
jquery: true
},
extends: [
'standard',
'plugin:flowtype/recommended'
// 'plugin:vue/recommended'
],
// required to lint *.vue files
plugins: [
'html',
'flowtype-errors',
'flowtype'
],
// add your custom rules here
rules: {
'flowtype-errors/show-errors': 2,
// allow paren-less arrow functions
'arrow-parens': 0,
'semi': ["error", "always"],
// allow async-await
'generator-star-spacing': 0
},
globals: {}
}
.babelrc
{
"presets": [
["env", { "modules": false }],
"stage-2",
["es2015", {"modules": false }],
"flow-vue"
],
"plugins": [
"transform-runtime",
"transform-class-properties",
"syntax-flow",
"transform-flow-strip-types"
],
"comments": false,
"env": {
"test": {
"presets": ["env", "stage-2"],
"plugins": [ "istanbul" ]
}
}
}
, 그것은 나던 구문 분석 flowtype 내가 바벨을 설정
instructions on the flow website을 다음과 같은 제안
여전히 도움이되지 않습니다. 나는 nuxt가 webpack config를 다루는 방식으로 어딘가로 나의 문제를 다소 좁혔다. 내가'npm run build'를 실행하면 완벽하게 작동합니다. 나는 dev 개발 방식이 작동하지 않는다고 생각한다. – nemoblob