Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Unexpected token export" when importing module from outside of pages dir #2850

Closed
1 task done
bentatum opened this issue Aug 25, 2017 · 1 comment
Closed
1 task done

Comments

@bentatum
Copy link

bentatum commented Aug 25, 2017

  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

This should work:

// in pages/index.js
import { Layout } from 'layout'
export default () => <Layout />

// in layout/index.js
export { default as Layout } from './Layout'

Current Behavior

export { default as Layout } from './Layout'
^^^^^^

SyntaxError: Unexpected token export

Steps to Reproduce

  1. Create a new next app.
  2. Add a custom server.js.
  3. Create a component outside of the pages directory.
  4. Import that component from within pages/index.js.
  5. yarn dev

Your Environment

Tech Version
next 3.0.6
node 8.2.1
OS macOS Sierra 10.12.4
@bentatum
Copy link
Author

nvm. this appears to be a duplicate of #883

@lock lock bot locked as resolved and limited conversation to collaborators May 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant