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)
- ZION GENERALS
- `testsFinishTimeout` does not print browser logs
- Concurrent tests don't call `requestAnimationFrame` consistently with Puppeteer HOT 2
- browserContext.newPage: Target closed (failed on Webkit) on macOS with M1 HOT 1
- [rollup-plugin-copy] `exports` should be optional
- [test-runner] Support per-test progress instead of per-file
- TypeError: Failed to fetch dynamically imported module: http://localhost:8000/...
- [rollup-plugin-copy][rollup-plugin-import-meta-assets]: type declarations defined in `exports` are not present in the published package
- Could not resolve import '@/utils/string' HOT 1
- Organize monorepo better HOT 8
- [@web/test-runner-visual-regression] Node is detached from document
- [@web/test-runner-playwright] browserType.launch: Executable doesn't exist HOT 1
- [dev-server] Loading library with large number of files freezes Chrome HOT 1
- Issues Implementing @web-test-runner in Docker Environment
- Dooplay theme
- Storybook higher than 7.5.3 does not export globals in @storybook/preview/globals
- Running fails with "cannot find module"
- test-runner-core always emits ansi codes to clear progress bars, even if there aren't progress bars
- Error: ENOENT: no such file or directory, stat '/test-mocks/prism.js'
- [rollup-plugin-html] No clearly documented / easy way to ignore modules
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.