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

How do I get --target=electron to play nice with yarn workspaces? #1571

Closed
emilsjolander opened this issue Jun 17, 2018 · 6 comments
Closed
Labels
❔ Question Stale Inactive issues

Comments

@emilsjolander
Copy link

❔ Question

How do I get --target=electron to play nice with yarn workspaces?

🔦 Context

I'm using yarn workspaces (https://yarnpkg.com/blog/2017/08/02/introducing-workspaces/) to organise my code in different packages within the same repo. However do to this basically just symlinking directories into node_modules it seems to break some assumptions in Parcel when bundling for electron.

Imagine I have this structure:

├── package.json
└── packages
    ├── module-one
    │   ├── index.ts
    │   └── package.json
    ├── module-two
        ├── index.ts
        └── package.json

Yarn workspaces will map that directly into node_modules like so, not that node_modules now has typescript files in it:

└── node_modules
    ├── module-one
    │   ├── index.ts
    │   └── package.json
    ├── module-two
        ├── index.ts
        └── package.json

The problem with this is that parcel (when run with --target=electron) will skip bundling any node_module dependencies and defer this to runtime require() call. However runtime require() will fail because it will try to require a typescript file which has not been bundled.

Everything works as expected with --target-browser. Can I somehow give parcel a list of packages to always bundle? Or can we perhaps get parcel to automatically look at workspaces in package.json to figure out which modules need to be bundled from node_modules?

@emilsjolander
Copy link
Author

Maybe one solution is to follow symlinks for the require and check wether it is located within node_modules or not?

@emilsjolander
Copy link
Author

emilsjolander commented Jun 17, 2018

I found #1101 by @devongovett which seems like it should have solved this. Although I added "source": true to the package.json of all my workspace modules and using parcel 1.9.1 it still does not bundle or compile these files that are symlinked into node_modules.

@rafaelcorreiapoli
Copy link

Any updates on this?

@gustavopch
Copy link

Suffering from the same problem with --target=node here.

@alidcast
Copy link

alidcast commented Dec 31, 2018

yes, i don't think that this is an electron specific problem, i'm facing the same problem bundling my react application.

@devongovett are parcel/symlinks+source compatible with yarn workspaces? (I couldn't find any other issue on it yet it doesn't seem to be fully working)

[edit] to be more specific, there seems to be two issues:

  • even though the symlink+source is getting picked, the module is still being looked for first under the child directory resulting in unresolved module errors
  • the babel configuration for the symlined module is not getting picked up so it's not getting transpiled as it normally would

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs.

@github-actions github-actions bot added the Stale Inactive issues label Jan 17, 2020
@github-actions github-actions bot closed this as completed Feb 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
❔ Question Stale Inactive issues
Projects
None yet
Development

No branches or pull requests

5 participants