Skip to content

Conversation

@audiolion
Copy link
Contributor

Potentially fixes #260

@swyxio
Copy link
Collaborator

swyxio commented Oct 18, 2019

@grimnomad can you test if this fixes the issue?

@grimnomad
Copy link

I tested the fix by manually altering the index.js on my machine. I don't know how to get this PR working with my project. But it doesn't work. CRA still fails, because there is no file at the time it tries to access the file.

This is what CRA prints:

Failed to compile.
../common/dist/index.js
Module not found: Can't resolve './common.cjs.development.js' in '<path/to/common>'

@audiolion
Copy link
Contributor Author

audiolion commented Oct 18, 2019

Bummer, I wonder if this is a different issue then. Could you make an example lerna repo where I could test this out?

As mentioned in the other thread, this could just be a race condition between tsdx and CRA where tsdx is cleaning the folder and CRA is trying to access it at the same time.

I suppose we could add a --no-clean option to the build command, thoughts @jaredpalmer ?

@grimnomad
Copy link

grimnomad commented Oct 18, 2019

https://github.com/grimnomad/lerna_tsdx

This is a minimal example. From my point of view it is a race condition.

A --no-clean flag was my initial thought as a solution.

@audiolion
Copy link
Contributor Author

so when I run that example repo it works without issue :( (I had to add a declare module 'common' in a common.d.ts file under src to get rid of the warning).

image

@grimnomad
Copy link

grimnomad commented Oct 18, 2019

I am starting the watch task not the build task.

In my opinion the missing module is a consequence of the "error". If I start both tasks manually (first common, than web) everything is ok. If I start them via lerna in parallel I get the module error.

I tested the build steps lerna run build --stream and lerna run build --parallel --stream. The latter errors, while the first one runs just fine.

@jaredpalmer
Copy link
Owner

Is this ready?

@audiolion
Copy link
Contributor Author

audiolion commented Oct 29, 2019

This change does not fix grimnomads issue, we can make this change if we want, it at least keeps the dist folder in existence if something else is relying/watching for it.

Grim's issue is that he is running a tsdx build process and a CRA start process at the same time, so CRA is trying to use files from another subpackage's dist folder and they are being moved/modified. I dont think there is a solution that we can provide for this, lerna would need to provide a way to sequentially order package scripts.

The --noClean option though in #282 provides an out for yarn workspace users, so imo we can either close this or, if we want to keep the dist folder around, merge the change.

@grimnomad
Copy link

@audiolion
I closed my issue, because the --noClean flag is a good enough solution for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

removing dist folder causes issues with parallel lerna processes

4 participants