[relay-compiler] This experimental syntax requires enabling the parser plugin: 'exportDefaultFrom'
Hello, :)
I'm in trouble to solve this issue.
I use :
- "react-relay": "1.5.0"
- "relay-compiler": "1.5.0",
- "relay-runtime": "1.5.0",
- "relay-local-schema": "^0.7.0",
⇒ ./node_modules/.bin/relay-compiler --verbose --src ./src/relay --schema ./resources/graphql/schema.json --extensions js --extensions jsx
HINT: pass --watch to keep watching for changes.
ERROR:
Parse error: SyntaxError: This experimental syntax requires enabling the parser plugin: 'exportDefaultFrom' (1:7) in "index.js"
From: CodegenRunner.compileAll
at /home/tristan/Documents/github/ui/node_modules/relay-compiler/bin/relay-compiler:2503:18
at /home/tristan/Documents/github/ui/node_modules/relay-compiler/bin/relay-compiler:2505:9
at Set.forEach (<anonymous>)
at ASTCache.parseFiles (/home/tristan/Documents/github/ui/node_modules/relay-compiler/bin/relay-compiler:2493:12)
at /home/tristan/Documents/github/ui/node_modules/relay-compiler/bin/relay-compiler:5144:15
at Object.run (/home/tristan/Documents/github/ui/node_modules/relay-compiler/bin/relay-compiler:481:31)
at CodegenRunner.parseFileChanges (/home/tristan/Documents/github/ui/node_modules/relay-compiler/bin/relay-compiler:5141:36)
at CodegenRunner.<anonymous> (/home/tristan/Documents/github/ui/node_modules/relay-compiler/bin/relay-compiler:5128:13)
at Generator.next (<anonymous>)
at step (/home/tristan/Documents/github/ui/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)
best regards
can you try latest version https://github.com/facebook/relay/releases/tag/v1.7.0-rc.1?
issue resolved :) thanks you
I just started using Relay and running into this issue with latest version of everything related.
export default from './Category'
export CategoryConnector from './CategoryConnector'
This is what the code that triggers SyntaxError looks like. And babel.config.js looks like this:
module.exports = {
presets: ['next/babel'],
plugins: [
[
'babel-plugin-module-resolver',
{
root: ['./src'],
},
],
'@babel/plugin-proposal-export-default-from',
'relay',
],
}
Changing order of plugins has no effect.
After digging some more into it I now realize that this works:
export default from './SomeThing'
But this doesn't:
export SomeThing from './SomeThing'
Which re-exports the default export as a named export. You might want to look into this; I personally use these kind of exports rarely and just excluded the folder where I'm using it as it doesn't contain anything for Relay anyway.
not sure if this is a valid syntax
try this
export { default as SomeThing } from './SomeThing'
Ah I see, it seems to be an additional proposal to the proposal 😅 https://github.com/tc39/proposal-export-default-from
I might try your way, it will probably work. For now I'm fine with excluding the folder.