milesj / packemon

📦 Build and prepare packages for npm distribution using standardized configurations and practices. Gotta pack 'em all!
https://packemon.dev
MIT License
203 stars 3 forks source link

fix: remove possible overlaps in paths #216

Closed wespickett closed 11 months ago

wespickett commented 12 months ago

There's an issue caused by this line: https://github.com/milesj/packemon/blob/master/packages/packemon/src/rollup/plugins/copyAndRefAssets.ts#L87

chunk.facadeModuleId is not ideal because the bundled code gets moved up to the root (output) directory compared to where it was located in the source files, the imports in the source files that get bundled get changed to be relative to the new bundle location, but the chunk.facadeModuleId is the old location of the index. So, you have the old path + the new updated imports and there could be overlap due to this "hoisting", which has a workaround in determineNewAsset

There doesn't seem to be a better path to use, so this is a workaround that should hopefully fix this issue. Maybe there is a better way to solve this?

wespickett commented 11 months ago

@milesj could you take a look at this PR? This is to fix an issue that is causing build failures

milesj commented 11 months ago

@wespickett Think you could add some tests? A bit hard to understand what's going on.

wespickett commented 11 months ago

@milesj Added a test. You can try that test on master and it will fail and you will see the issue there. Had to make a small change to the plugin to have something to assert

milesj commented 11 months ago

Thanks, just need to fix the 1 test failure

wespickett commented 11 months ago

@milesj Seems like an unrelated failure:

Screenshot 2023-07-26 at 6 10 16 PM

Also can't seem to reproduce it locally:

Screenshot 2023-07-26 at 3 45 40 PM Screenshot 2023-07-26 at 3 44 13 PM

Are you able to re-run failed jobs? I don't seem to have that option

milesj commented 11 months ago

Yup was flaky. Godd stuff!