Skip to content

Unexpected token after eject with Component Folders with package.json #5865

Closed
@derpoho

Description

@derpoho

Is this a bug report?

Yes

Did you try recovering your dependencies?

Yes
npm: 6.4.1
node: v9.10.1

Which terms did you search for in User Guide?

package.json, Unexpected token...

Environment

System:
OS: macOS 10.14.1
CPU: x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
Binaries:
Node: 9.10.1 - ~/.nvm/versions/node/v9.10.1/bin/node
Yarn: 1.7.0 - /usr/local/bin/yarn
npm: 6.4.1 - ~/.nvm/versions/node/v9.10.1/bin/npm
Browsers:
Chrome: 70.0.3538.102
Firefox: 61.0.2
Safari: 12.0.1
npmPackages:
react: ^16.6.3 => 16.6.3
react-dom: ^16.6.3 => 16.6.3
react-scripts: Not Found
npmGlobalPackages:
create-react-app: Not Found

Steps to Reproduce

(Write your steps here:)

  1. install cra
  2. create a component in a folder with an package.json in it which is referring the main component file
  3. import it in App.js
  4. keep building successfully
  5. eject cra
  6. build fails with unexpected token in the imported component

Expected Behavior

I expect it to build successfully

Actual Behavior

Build fails on first JSX from the imported component with an unexpected token error.

Reproducible Demo

Did a very basic demo of the bug.
App before ejecting is here: https://github.com/derpoho/cra-packaged-components-error/tree/master => builds
App after eject is here: https://github.com/derpoho/cra-packaged-components-error/tree/ejected => fails

Thanks guys, keep up the good work!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions