Comments (8)
Is this just confusing code or it's broken too?
It's indeed confusing, but IIRC we process all import.meta.url
and add extra URL wrapper to resolve it relatively to the original file location after bundling, where the JS file location often changes, so the extra wrapper is necessary in a general case.
from web.
It's broken in rspack, but I think of it as a flaw of rspack after your explanation, I have filed an issue to their team.
from web.
Oh, actually, I just looked once more at the screenshot. After bundling the wrapper should contain the original file name, and not just import.meta.url
twice, e.g. smth like this - a rewritten example from my app bundle, but should be clear I think:
new URL("./../../../assets/images/",new URL("./node_modules/path/to/my/original/file.js",import.meta.url).href).href;
Looks like smth is not working correctly in Vite.
Maybe our plugin is not Vite compatible, not sure if anyone ever tested it with it.
IIRC, Vite plugins are an extension of rollup API and should be working fine with most of rollup plugins, but I can imagine it's not always guaranteed.
from web.
emm, actually the output result is working fine in webpack where the double URL would be replaced with the real path. 🤔🤔
from web.
emm, actually the output result is working fine in webpack where the double URL would be replaced with the real path. 🤔🤔
if it's working, then probably your JS files remain on the same location in the folder structure, otherwise won't work, but if so, you might not need this plugin, I think the main goal of it is to be able to bundle JS and extract assets
on a different note: why do you need this plugin in Vite? I think Vite has it's own assets handling guidelines?
from web.
in vite's library mode,all assets will be inlined,which causes a long time cost.unfortunately It doesn't support to extract assets now...
from web.
Pure Rollup gives me:
const program_path = new URL(new URL('asset/program.wasm', import.meta.url).href, import.meta.url);
The second URL constructor looks pointless to me.
from web.
Pure Rollup gives me:
const program_path = new URL(new URL('asset/program.wasm', import.meta.url).href, import.meta.url);
The second URL constructor looks pointless to me.
Does it mean you can remove the double wrap?🤔
from web.
Related Issues (20)
- Coverage not generated when we are using babel with custom browser [locally]
- Test Runner config rootPath is resolved relative to cwd, not the path of the config
- Test Runner 'manual' mode import path is not relative to rootPath
- Update @web/dev-server-esbuild dependencie esbuild to v0.21 HOT 2
- Contributing guide uses npm, GitHub actions use Yarn HOT 1
- [@web/test-runner] Tests do not finish when asserting frozen objects
- Node tests failing on Windows
- Out-of-date instruction to use run-playwright-tests HOT 1
- @web/rollup-plugin-import-meta-assets: Types not part of the exports declaration in package.json
- How can I set the browser's locale when using the Web Test Runner with Playwright?
- TypeError: URL.canParse is not a function HOT 1
- [dev-server] CVE-2024-29415: "ip SSRF improper categorization in isPublic" HOT 16
- Mermaid Library issue in web-dev-server HOT 3
- [dev-server-core | dev-server-hmr] CVE-2024-37890: "ws affected by a DoS when handling a request with many HTTP headers" HOT 1
- [@web/dev-server-rollup] Higher version of whatwg-url HOT 1
- [@web/test-runner-browserstack] + [@web/dev-server-legacy]: issues when using BrowserStack launcher for targeting certain older devices
- wtr: fails to compile standard decorators HOT 2
- question about packages/dev-server-import-maps HOT 3
- Support for Consumer Driven Contract creation using PactJS
- How to import HTML file using esbuild's text loader?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from web.