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

Transpiling components outside /pages? #883

Closed
malexdev opened this issue Jan 25, 2017 · 4 comments
Closed

Transpiling components outside /pages? #883

malexdev opened this issue Jan 25, 2017 · 4 comments

Comments

@malexdev
Copy link

Hello! I'm just now getting started with next (using version 1.2.3), and I have the following folder structure:

  • package.json
  • pages
    • index.js
  • lib
    • components
      • Test.js

I have a symlink: node_modules/lib -> ../lib.
I import my Test component with import Test from 'lib/components/Test'.

This works fine, but it seems to not be transpiled: if I import anything from my Test component, I get the following error: SyntaxError: Unexpected token import.

Any guidance here? I'd be fine having my /components under /pages but I don't want them to be able to be served up standalone.

Thanks!

@timneutkens
Copy link
Member

Duplicate of #706

@timneutkens
Copy link
Member

Short term answer is use relative paths for now. So import Test from 'lib/components/Test' would become import Test from '../lib/components/Test'

@malexdev
Copy link
Author

Ah, sorry for the duplicate, and makes sense about not transpiling node_modules. Thanks!

@timneutkens
Copy link
Member

🙌

@lock lock bot locked as resolved and limited conversation to collaborators May 12, 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

2 participants