Skip to content

ModuleParseError when referencing external repo #3088

@lancejpollard

Description

@lancejpollard

Getting this when I try to reference a separate project (repo/b/components/layout.js):

ModuleParseError: Module parse failed: /path/to/repo/a/node_modules/react-hot-loader/webpack.js!/path/to/repo/b/components/layout.js Unexpected token (65:17)
You may need an appropriate loader to handle this file type.
|     return <div></div>
...

The paths are like:

/repo/a
/repo/a/pages/page1.js
/repo/b
/repo/b/components/layout.js

And in page1.js it is doing this:

import Layout from '../../b/components/layout'

The next server is running from within repo a:

cd repo/a
npm run dev # which is this:
babel-node --presets=es2015,stage-0 --plugins=transform-react-jsx,styled-jsx/babel server.js

Expected Behavior

Expected behavior is that I can load this JSX module from a separate repo outside of the main project.

Current Behavior

Current behavior is that I can't abstract out code into a separate repo if it has JSX in it.

Context

I can't refactor code into a shared lib.

Your Environment

Tech Version
next 4beta2
node 8.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions