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

Support asset relocation like @vercel/ncc ? #1100

Open
abcfy2 opened this issue Mar 27, 2024 · 2 comments
Open

Support asset relocation like @vercel/ncc ? #1100

abcfy2 opened this issue Mar 27, 2024 · 2 comments

Comments

@abcfy2
Copy link

abcfy2 commented Mar 27, 2024

Could you please support asset relocation feature like @vercel/ncc? https://github.com/vercel/webpack-asset-relocator-loader#how-it-works

@vercel/ncc could support path.join() asset been copied to dist directory. Would you please also support this feature ?

Thanks.

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar
@pqt
Copy link

pqt commented Mar 28, 2024

If I'm understanding you correctly, aren't you asking for this? https://tsup.egoist.dev/#copy-files-to-output-directory

@abcfy2
Copy link
Author

abcfy2 commented Mar 29, 2024

If I'm understanding you correctly, aren't you asking for this? https://tsup.egoist.dev/#copy-files-to-output-directory

Not just for this. @vercel/ncc could fix the path.join after assets copy.

For example. Here's the project structure:

.
`-- src
  `-- index.ts
`-- public
  `-- myimg.png

In the index.ts:

const pngFile = path.join(__dirname, '../public/myimg.png');
// ... SNIP ...

After use @vercel/ncc build, src/index.ts could be compile to dist/index.js, and public/myimg.png could copy to dist/myimg.png, and path.join should be correct after copy assets. But Copy files to output directory does not solve the path after copy.

So @vercel/ncc call this Asset Relocation.

In @vercel/ncc, if you use process.cwd(), __filename, __dirname, path.*(), require.resolve, the related files should be also copy to dist, and auto correct the path.

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

No branches or pull requests

2 participants