2016-08-26 6 views
3

下記の設定で上記のエラーが発生しました。'foreign'で指定されたプラグイン0が '_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} 
}); 
// 
// 
// 

ターミナルエラー:バベルノードserver.js

ERROR ./js/app.js
モジュールのビルドに失敗しました:エラー:

キャッチされない不変違反:localhostを::コンソールウィンドウで3000

プラグイン0で指定した '外国人' '_c'

ブラウザエラーの無効なプロパティを提供します: RelayQL:実行時の予期せぬ呼び出し。バベル変換が設定されていないか、このコールサイトを特定できませんでした。そのまま使用していることを確認してください。Relay.QL

答えて

2

私は以下のセットアップを使用して成功しました。私はWebPACKのでは私のWebPACKモジュールにおけるバベルローダーではなく.babelrc

でプラグインを使用しています:.babelrcで

query: { 
    presets: [ 
    "es2015", "react", "stage-0", { 
     "plugins": [ 
     "./schema-build/babelRelayPlugin" 
     ] 
    } 
    ] 
} 

を:

{ 
    "passPerPreset": true, 
    "presets": [ 
    "react", 
    "es2015", 
    "stage-0" 
    ] 
} 
+0

それは動作しますが、どうもありがとうございました。 – Trunks

関連する問題