'foreign' 中指定的插件 0 提供了 '_c' 的无效 属性
Plugin 0 specified in 'foreign' provided an invalid property of '_c'
使用以下配置出现上述错误,我应该如何让它工作?
.babelrc:
{
"passPerPreset": true,
"presets": [
{"plugins": ["./build/babelRelayPlugin"]},
"react",
"es2015",
"stage-0"
]
}
package.json:
{
"name": "1",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"babel-core": "^6.14.0",
"babel-loader": "^6.2.5",
"babel-polyfill": "^6.13.0",
"babel-preset-es2015": "^6.14.0",
"babel-preset-react": "^6.11.1",
"babel-preset-stage-0": "^6.5.0",
"babel-relay-plugin": "^0.9.2",
"express": "^4.14.0",
"express-graphql": "^0.5.3",
"graphql": "^0.6.2",
"graphql-relay": "^0.4.2",
"react": "^15.3.1",
"react-dom": "^15.3.1",
"react-relay": "^0.9.2",
"webpack": "^1.13.2",
"webpack-dev-server": "^1.15.0"
},
"devDependencies": {
"babel-cli": "^6.14.0"
}
}
server.js:
//
//
//
const compiler = webpack({
entry: path.resolve(__dirname, 'js', 'app.js'),
module: {
loaders: [
{
test: /\.js$/,
include: [ path.resolve(__dirname, "js") ],
exclude: /node_modules/,
loader: 'babel-loader',
query: {
presets: ['react', 'es2015', 'stage-0'],
},
}
],
},
output: {filename: '/app.js', path: '/', publicPath: '/js/'}
});
const appServer = new WebpackDevServer(compiler, {
contentBase: '/public/',
proxy: {'/graphql': 'http://localhost:8000'},
publicPath: '/js/',
stats: {colors: true}
});
//
//
//
终端错误:babel-node server.js
./js/app.js 中的错误
模块构建失败:错误:'foreign' 中指定的插件 0 提供了 '_c'
的无效 属性
浏览器错误:本地主机:3000
在控制台中 window:
未捕获的不变违规:RelayQL:运行时意外调用。未设置 Babel 转换,或者无法识别此调用站点。确保它被逐字用作 Relay.QL
.
我使用以下设置取得了成功。我在我的 webpack 模块中使用带有 babel 加载器的插件,而不是 .babelrc
在网络包中:
query: {
presets: [
"es2015", "react", "stage-0", {
"plugins": [
"./schema-build/babelRelayPlugin"
]
}
]
}
在 .babelrc 中:
{
"passPerPreset": true,
"presets": [
"react",
"es2015",
"stage-0"
]
}
使用以下配置出现上述错误,我应该如何让它工作?
.babelrc:
{
"passPerPreset": true,
"presets": [
{"plugins": ["./build/babelRelayPlugin"]},
"react",
"es2015",
"stage-0"
]
}
package.json:
{
"name": "1",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"babel-core": "^6.14.0",
"babel-loader": "^6.2.5",
"babel-polyfill": "^6.13.0",
"babel-preset-es2015": "^6.14.0",
"babel-preset-react": "^6.11.1",
"babel-preset-stage-0": "^6.5.0",
"babel-relay-plugin": "^0.9.2",
"express": "^4.14.0",
"express-graphql": "^0.5.3",
"graphql": "^0.6.2",
"graphql-relay": "^0.4.2",
"react": "^15.3.1",
"react-dom": "^15.3.1",
"react-relay": "^0.9.2",
"webpack": "^1.13.2",
"webpack-dev-server": "^1.15.0"
},
"devDependencies": {
"babel-cli": "^6.14.0"
}
}
server.js:
//
//
//
const compiler = webpack({
entry: path.resolve(__dirname, 'js', 'app.js'),
module: {
loaders: [
{
test: /\.js$/,
include: [ path.resolve(__dirname, "js") ],
exclude: /node_modules/,
loader: 'babel-loader',
query: {
presets: ['react', 'es2015', 'stage-0'],
},
}
],
},
output: {filename: '/app.js', path: '/', publicPath: '/js/'}
});
const appServer = new WebpackDevServer(compiler, {
contentBase: '/public/',
proxy: {'/graphql': 'http://localhost:8000'},
publicPath: '/js/',
stats: {colors: true}
});
//
//
//
终端错误:babel-node server.js
./js/app.js 中的错误
模块构建失败:错误:'foreign' 中指定的插件 0 提供了 '_c'
浏览器错误:本地主机:3000
在控制台中 window:
未捕获的不变违规:RelayQL:运行时意外调用。未设置 Babel 转换,或者无法识别此调用站点。确保它被逐字用作 Relay.QL
.
我使用以下设置取得了成功。我在我的 webpack 模块中使用带有 babel 加载器的插件,而不是 .babelrc
在网络包中:
query: {
presets: [
"es2015", "react", "stage-0", {
"plugins": [
"./schema-build/babelRelayPlugin"
]
}
]
}
在 .babelrc 中:
{
"passPerPreset": true,
"presets": [
"react",
"es2015",
"stage-0"
]
}