[英]Babel-node not lncluding .graphql files in build
I'm loading .graphql files like this:我正在加载这样的 .graphql 文件:
import { join } from 'path'
import { loadSchemaSync } from '@graphql-tools/load'
import { GraphQLFileLoader } from '@graphql-tools/graphql-file-loader'
import { addResolversToSchema } from '@graphql-tools/schema'
import resolvers from './resolvers'
const schema = loadSchemaSync(join(__dirname, './typedefs/*.graphql'), { loaders: [new GraphQLFileLoader()] })
const schemaWithResolver = addResolversToSchema({
schema,
resolvers
})
export default schemaWithResolver
When I build for production, the folder ./typedefs
is not included in the build output (dist).当我为生产构建时,文件夹
./typedefs
不包含在构建输出 (dist) 中。
This is the build cmd: "build-babel": "babel ./src -s -d dist"
这是构建 cmd:
"build-babel": "babel ./src -s -d dist"
How do include .graphql extensions in the babel cmd above?如何在上面的 babel cmd 中包含 .graphql 扩展名?
You can add the --copy-files
flag to include non-js files.您可以添加
--copy-files
标志以包含非 js 文件。
Changing the build command to this should work:将构建命令更改为此应该可以工作:
"build-babel": "babel ./src -s -d dist --copy-files"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.