We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
// index.js import IMAGE_URL from './image.png'; console.log(IMAGE_URL);
// rollup.config.js export default { input: './index.js', output: { file: './bundle.js', format: 'umd', }, plugins: [{ load(id) { if (!id.endsWith('.png')) { return null; } let buffer = require('fs').readFileSync(id); let asset = this.emitAsset(path.basename(id), buffer); return `export default import.meta.ROLLUP_ASSET_URL_${asset};`; } }], }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <script src="bundle.js?test=1"></script> </body> </html>
The IMAGE_URL value is http://localhost/image.png
IMAGE_URL
http://localhost/image.png
The IMAGE_URL value is http://localhost/bundle.js?test=1/../image.png
http://localhost/bundle.js?test=1/../image.png
The text was updated successfully, but these errors were encountered:
I think this should be fixable by using the URL constructor a little more intelligently but I need to check.
URL
Sorry, something went wrong.
Fix at #2937
Successfully merging a pull request may close this issue.
How Do We Reproduce?
Expected Behavior
The
IMAGE_URL
value ishttp://localhost/image.png
Actual Behavior
The
IMAGE_URL
value ishttp://localhost/bundle.js?test=1/../image.png
The text was updated successfully, but these errors were encountered: