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)
- [@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?
- Sinon Chai calledWithMatch causes structuredClone to error in the test runner HOT 11
- Using Istanbul for instrumentation (instead of V8) HOT 4
- Coverage report is not correct when Rollup Inject is used HOT 4
- junit report is empty even with successful tests HOT 2
- web
- Cannot run tests on a Remote Selenium Grid
- Sonar and Junit support for Angular with multiple modules
- Test Runner: `sinon-chai` failures not picked up HOT 1
- Config loader: test fails since Node v22.7.0
- No launch error output using Playwright + summaryReporter HOT 1
- [@web/test-runner]: Logging complex (including circular) objects brings tests to a near-halt HOT 1
- Tests do not finish or hangs when asserting window - structuredClone errors HOT 4
- `visualDiff` of `@web/test-runner-visual-regression` can't be imported
- [dev-server] Configure what browser should be used when --open is used.
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.