-
Notifications
You must be signed in to change notification settings - Fork 0
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
svelte-retag
doesnot work with await import
statement
#31
Comments
I'm new to dynamic imports, but thankfully this has nothing to do with
Works fine for me. Edit: p.s. If this is wrong, please feel free to reopen and let me know. 😅 |
Actually @baseplate-admin, after giving this more thought, I might want to support a variant of this as an enhancement: Lazy dynamic imports. That is, more specifically: Not This could be used to enable the ability of defining custom elements like So, this would support two major use cases (one building upon the other).
While you could already do option 2 right now, it would only be possible via adding |
Update index.ts Update index.ts
It's okay if you modify this issue :) ( personally i think since you figured out a better approach on this issue, it's better to rename this one )
So the problem i faced was, the project I am working on is large in nature ( 10+ MB ). I want to split split each svelte component into it's own This is the bundle size before ../static/.vite/manifest.json 6.53 kB │ gzip: 0.86 kB
../static/coreproject.asset.Kokoro-SemiBoldItalic.ixtmLYl7.woff2 36.18 kB
../static/coreproject.asset.Kokoro-BoldItalic.qI4mF21P.woff2 36.18 kB
../static/coreproject.asset.Kokoro-Italic.uaj3Riha.woff2 36.92 kB
../static/coreproject.asset.Kokoro-Bold.4fcmChkF.woff2 39.82 kB
../static/coreproject.asset.Kokoro-SemiBold.MAoxE-AD.woff2 39.98 kB
../static/coreproject.asset.Kokoro-Regular.RfpxELwh.woff2 40.41 kB
../static/coreproject.asset.index.46WfX2Md.css 1.32 kB │ gzip: 0.62 kB
../static/coreproject.asset.index.hyP7NsuW.css 102.38 kB │ gzip: 17.22 kB
../static/coreproject.chunk._commonjsHelpers.5-cIlDoe.js 0.31 kB │ gzip: 0.24 kB │ map: 0.13 kB
../static/coreproject.chunk.index.esm.7ZU_BHz0.js 5.71 kB │ gzip: 2.93 kB │ map: 8.01 kB
../static/coreproject.entry.easytimer.EfkVFB83.js 7.24 kB │ gzip: 2.88 kB │ map: 34.19 kB
../static/coreproject.entry.register.JSRn3LgI.js 28.28 kB │ gzip: 10.18 kB │ map: 136.97 kB
../static/coreproject.entry.htmx.TaxAOfcZ.js 56.27 kB │ gzip: 16.83 kB │ map: 230.86 kB
../static/coreproject.entry.hyperscript.kn0nY75f.js 94.96 kB │ gzip: 26.47 kB │ map: 219.25 kB
../static/coreproject.chunk.index.esm.dwzZYf7S.js 174.96 kB │ gzip: 81.02 kB │ map: 177.24 kB
../static/coreproject.chunk.index.esm.0AbFLnpp.js 214.06 kB │ gzip: 94.58 kB │ map: 216.66 kB
../static/coreproject.chunk.index.esm.h-q4_oJ_.js 425.35 kB │ gzip: 196.26 kB │ map: 428.34 kB
../static/coreproject.chunk.index.esm.F35oWm2J.js 459.13 kB │ gzip: 202.46 kB │ map: 462.12 kB
../static/coreproject.chunk.index.esm.7m77ow97.js 464.88 kB │ gzip: 231.61 kB │ map: 490.47 kB
../static/coreproject.chunk.index.esm.XbRhiM0i.js 489.24 kB │ gzip: 225.61 kB │ map: 491.87 kB
../static/coreproject.chunk.index.esm.ZT1N5kiN.js 565.13 kB │ gzip: 269.45 kB │ map: 567.75 kB
../static/coreproject.chunk.index.esm.1uJe1-pR.js 596.23 kB │ gzip: 271.59 kB │ map: 598.86 kB
../static/coreproject.chunk.index.esm.ImDc22WR.js 639.86 kB │ gzip: 281.03 kB │ map: 642.48 kB
../static/coreproject.chunk.index.esm.-6AdGpRj.js 730.97 kB │ gzip: 340.19 kB │ map: 733.60 kB
../static/coreproject.chunk.index.esm.qoep7B_f.js 804.56 kB │ gzip: 366.03 kB │ map: 807.18 kB
../static/coreproject.chunk.index.esm.Ipz4x2MM.js 811.02 kB │ gzip: 371.37 kB │ map: 814.35 kB
../static/coreproject.chunk.index.esm.lIq_N4yZ.js 1,216.41 kB │ gzip: 565.00 kB │ map: 1,219.04 kB
../static/coreproject.entry.index.QMLtyh7Q.js 1,243.26 kB │ gzip: 393.74 kB │ map: 2,726.71 kB This is the bundle size after ../static/.vite/manifest.json 23.24 kB │ gzip: 2.32 kB
../static/coreproject.asset.Kokoro-SemiBoldItalic.ixtmLYl7.woff2 36.18 kB
../static/coreproject.asset.Kokoro-BoldItalic.qI4mF21P.woff2 36.18 kB
../static/coreproject.asset.Kokoro-Italic.uaj3Riha.woff2 36.92 kB
../static/coreproject.asset.Kokoro-Bold.4fcmChkF.woff2 39.82 kB
../static/coreproject.asset.Kokoro-SemiBold.MAoxE-AD.woff2 39.98 kB
../static/coreproject.asset.Kokoro-Regular.RfpxELwh.woff2 40.41 kB
../static/coreproject.asset.Index.46WfX2Md.css 1.32 kB │ gzip: 0.62 kB
../static/coreproject.asset.index.hyP7NsuW.css 102.38 kB │ gzip: 17.22 kB
../static/coreproject.chunk.each.-oqiv04n.js 0.13 kB │ gzip: 0.14 kB │ map: 4.04 kB
../static/coreproject.chunk._commonjsHelpers.5-cIlDoe.js 0.31 kB │ gzip: 0.24 kB │ map: 0.13 kB
../static/coreproject.chunk.Index.gCjgE0HX.js 0.95 kB │ gzip: 0.55 kB │ map: 0.83 kB
../static/coreproject.chunk.Index.gICmB5P1.js 0.95 kB │ gzip: 0.55 kB │ map: 0.83 kB
../static/coreproject.chunk.preload-helper.H5tK7HSf.js 0.95 kB │ gzip: 0.60 kB │ map: 0.13 kB
../static/coreproject.chunk.Index.YfYq1_V8.js 0.97 kB │ gzip: 0.48 kB │ map: 1.11 kB
../static/coreproject.chunk.Index.IGI89-5t.js 1.03 kB │ gzip: 0.59 kB │ map: 0.91 kB
../static/coreproject.chunk.Index.VQ_-SwUh.js 1.04 kB │ gzip: 0.60 kB │ map: 0.91 kB
../static/coreproject.chunk.Index.g5Beh79I.js 1.05 kB │ gzip: 0.60 kB │ map: 0.93 kB
../static/coreproject.chunk.Index.j4TPyIBK.js 1.09 kB │ gzip: 0.63 kB │ map: 0.96 kB
../static/coreproject.chunk.Index.mwl_S5n7.js 1.20 kB │ gzip: 0.67 kB │ map: 1.09 kB
../static/coreproject.chunk.Index.rIRaFJwk.js 1.21 kB │ gzip: 0.62 kB │ map: 1.00 kB
../static/coreproject.chunk.Index.Dwyj-T1p.js 1.22 kB │ gzip: 0.63 kB │ map: 1.17 kB
../static/coreproject.chunk.Index.S7f8dsCI.js 1.23 kB │ gzip: 0.72 kB │ map: 1.13 kB
../static/coreproject.chunk.Index.m1HqqgoL.js 1.25 kB │ gzip: 0.69 kB │ map: 1.23 kB
../static/coreproject.chunk.Index._tC2liuT.js 1.33 kB │ gzip: 0.76 kB │ map: 1.28 kB
../static/coreproject.chunk.Index.q_Cx6xF5.js 1.41 kB │ gzip: 0.81 kB │ map: 1.27 kB
../static/coreproject.chunk.Index.miwBtL35.js 1.45 kB │ gzip: 0.68 kB │ map: 1.45 kB
../static/coreproject.chunk.Index.ChjI5wu6.js 1.45 kB │ gzip: 0.74 kB │ map: 1.32 kB
../static/coreproject.chunk.Index._dWsB-ZV.js 1.49 kB │ gzip: 0.78 kB │ map: 1.35 kB
../static/coreproject.chunk.Index.OW2A2AZo.js 1.50 kB │ gzip: 0.79 kB │ map: 1.36 kB
../static/coreproject.chunk.Index.eNKjvz8X.js 1.54 kB │ gzip: 0.80 kB │ map: 1.49 kB
../static/coreproject.chunk.Index.Bzxwcnma.js 1.54 kB │ gzip: 0.74 kB │ map: 1.57 kB
../static/coreproject.chunk.Index.UtpnH4Ur.js 1.56 kB │ gzip: 0.81 kB │ map: 1.51 kB
../static/coreproject.chunk.Index.zuIMKu4r.js 1.57 kB │ gzip: 0.80 kB │ map: 1.79 kB
../static/coreproject.chunk.Index.eptf_36i.js 1.59 kB │ gzip: 0.93 kB │ map: 1.47 kB
../static/coreproject.chunk.Index.3FJoscsc.js 1.61 kB │ gzip: 0.88 kB │ map: 1.47 kB
../static/coreproject.chunk.Index.-2WF-kaN.js 1.61 kB │ gzip: 0.87 kB │ map: 1.47 kB
../static/coreproject.chunk.Index.ZIjoBqyt.js 1.67 kB │ gzip: 0.90 kB │ map: 1.66 kB
../static/coreproject.chunk.Index.94qjRHFU.js 1.72 kB │ gzip: 0.84 kB │ map: 1.58 kB
../static/coreproject.chunk.Index.jztN-mgi.js 1.72 kB │ gzip: 0.82 kB │ map: 1.79 kB
../static/coreproject.chunk.Index.d1pz6nbi.js 1.90 kB │ gzip: 0.91 kB │ map: 1.71 kB
../static/coreproject.chunk.Index.aVR-sCWN.js 1.91 kB │ gzip: 1.07 kB │ map: 1.77 kB
../static/coreproject.chunk.Index.edSJ8a7k.js 1.91 kB │ gzip: 1.07 kB │ map: 1.78 kB
../static/coreproject.chunk.Index.1bh806ox.js 2.01 kB │ gzip: 1.11 kB │ map: 1.87 kB
../static/coreproject.chunk.Index._XQBgcfX.js 2.06 kB │ gzip: 1.05 kB │ map: 1.88 kB
../static/coreproject.chunk.Index.Vj8E_Kca.js 2.12 kB │ gzip: 0.90 kB │ map: 2.27 kB
../static/coreproject.chunk.Index.UauWsCM8.js 2.21 kB │ gzip: 1.04 kB │ map: 3.14 kB
../static/coreproject.chunk.Index.15hE_D64.js 2.23 kB │ gzip: 1.03 kB │ map: 3.18 kB
../static/coreproject.chunk.Index.-Z3JR3MX.js 2.30 kB │ gzip: 1.09 kB │ map: 2.16 kB
../static/coreproject.chunk.Index.wjuy4qYp.js 2.31 kB │ gzip: 1.13 kB │ map: 2.69 kB
../static/coreproject.chunk.Index.SGybuoKj.js 2.53 kB │ gzip: 1.20 kB │ map: 3.47 kB
../static/coreproject.chunk.Index.bZTpm6G5.js 2.54 kB │ gzip: 1.15 kB │ map: 2.61 kB
../static/coreproject.chunk.Index.Xx2Mncqr.js 2.77 kB │ gzip: 1.43 kB │ map: 2.63 kB
../static/coreproject.chunk.Index.Sn0Q3PtZ.js 2.89 kB │ gzip: 1.14 kB │ map: 4.23 kB
../static/coreproject.chunk.Index.s38NhnjV.js 3.15 kB │ gzip: 1.57 kB │ map: 3.03 kB
../static/coreproject.chunk.Index.BGNcwDjv.js 4.77 kB │ gzip: 2.00 kB │ map: 5.35 kB
../static/coreproject.chunk.Index.jXZmbUH0.js 5.32 kB │ gzip: 2.23 kB │ map: 5.54 kB
../static/coreproject.chunk.index.esm.7ZU_BHz0.js 5.71 kB │ gzip: 2.93 kB │ map: 8.01 kB
../static/coreproject.entry.easytimer.EfkVFB83.js 7.24 kB │ gzip: 2.88 kB │ map: 34.19 kB
../static/coreproject.chunk.index.vTrRw-G_.js 8.24 kB │ gzip: 3.53 kB │ map: 9.54 kB
../static/coreproject.chunk.index._9vMi-ax.js 8.66 kB │ gzip: 3.54 kB │ map: 95.31 kB
../static/coreproject.chunk.Index.zAO-Aiqo.js 8.68 kB │ gzip: 3.20 kB │ map: 8.68 kB
../static/coreproject.entry.index.Cxd2XD8u.js 15.57 kB │ gzip: 4.17 kB │ map: 53.97 kB
../static/coreproject.chunk.Index.jQgzB9pD.js 16.81 kB │ gzip: 6.75 kB │ map: 38.05 kB
../static/coreproject.chunk.Index.fSPSO0qx.js 19.07 kB │ gzip: 7.12 kB │ map: 53.59 kB
../static/coreproject.chunk.classname.r0xsQ-TV.js 20.06 kB │ gzip: 6.64 kB │ map: 104.51 kB
../static/coreproject.entry.register.D_-KkPz6.js 27.48 kB │ gzip: 9.77 kB │ map: 136.97 kB
../static/coreproject.entry.htmx.TaxAOfcZ.js 56.27 kB │ gzip: 16.83 kB │ map: 230.86 kB
../static/coreproject.entry.hyperscript.kn0nY75f.js 94.96 kB │ gzip: 26.47 kB │ map: 219.25 kB
../static/coreproject.chunk.index.esm.dwzZYf7S.js 174.96 kB │ gzip: 81.02 kB │ map: 177.24 kB
../static/coreproject.chunk.index.esm.0AbFLnpp.js 214.06 kB │ gzip: 94.58 kB │ map: 216.66 kB
../static/coreproject.chunk.index.esm.h-q4_oJ_.js 425.35 kB │ gzip: 196.26 kB │ map: 428.34 kB
../static/coreproject.chunk.index.esm.F35oWm2J.js 459.13 kB │ gzip: 202.46 kB │ map: 462.12 kB
../static/coreproject.chunk.index.esm.7m77ow97.js 464.88 kB │ gzip: 231.61 kB │ map: 490.47 kB
../static/coreproject.chunk.index.esm.XbRhiM0i.js 489.24 kB │ gzip: 225.61 kB │ map: 491.87 kB
../static/coreproject.chunk.index.esm.ZT1N5kiN.js 565.13 kB │ gzip: 269.45 kB │ map: 567.75 kB
../static/coreproject.chunk.index.esm.1uJe1-pR.js 596.23 kB │ gzip: 271.59 kB │ map: 598.86 kB
../static/coreproject.chunk.index.esm.ImDc22WR.js 639.86 kB │ gzip: 281.03 kB │ map: 642.48 kB
../static/coreproject.chunk.index.esm.-6AdGpRj.js 730.97 kB │ gzip: 340.19 kB │ map: 733.60 kB
../static/coreproject.chunk.index.esm.qoep7B_f.js 804.56 kB │ gzip: 366.03 kB │ map: 807.18 kB
../static/coreproject.chunk.index.esm.Ipz4x2MM.js 811.02 kB │ gzip: 371.37 kB │ map: 814.35 kB
../static/coreproject.chunk.Index.cpNNh98l.js 1,081.87 kB │ gzip: 346.55 kB │ map: 2,282.95 kB
../static/coreproject.chunk.index.esm.lIq_N4yZ.js 1,216.41 kB │ gzip: 565.00 kB │ map: 1,219.04 kB See many many small chunks? That's what i was looking for |
My another reason behind this was to prevent duplication, by
svelteRetag({
component: () => import('./HelloWorld.svelte'),
tagname: 'hello-world',
}); And the import of ./HelloWorld.svelte wouldn't happen until after is encountered. Uh can you do this?
Is this possible to do? I dont think it is possible without some rather tricky sorcery. |
Most definitely. 😄 The hard part for me right now is settling on a very solid and intuitive syntax that is also efficient. That's critical because if I don't get that right, folks will get confused and start submitting issues/bugs and using the library in unexpected ways. e.g. Right now this library is officially "backward compatible with // Most intuitive for user, but requires inferring if this is just an arrow function (*both* lambda or callback func) vs. an actual component
svelteRetag({
component: () => import('./HelloWorld.svelte'),
tagname: 'hello-world',
});
// Less intuitive, but far more efficient at the library level as it's not having to perform any advanced juggling to infer type
svelteRetag({
component: () => import('./HelloWorld.svelte'),
lazy: true, // required if above is not a component but a lazy dynamic import
tagname: 'hello-world',
}); But folks could get confused with that second syntax and just set |
Ok. Give me some time to update the title and the initial comment (I'll scrap it and replace with my own), if that's alright. I'll add a disclaimer so folks know who wrote it, since that first comment will be under your name. Also: There's already some witchcraft in Hold off on this issue and I'll reopen it soon. |
svelte-retag
doesnot work with await import
statement() => import()
Actually @baseplate-admin, I probably shouldn't have promised to just edit this issue. It's intuitive to us, but for anyone else they'd have to read through this entire convo for context. Plus, I have a standard template for feature requests. I think it'll be simpler if I instead just create a new issue with the feature request template, explain your problem (in your words and pinging you) and then layout the technical specs as I see them. I'll revert my changes to this issue now. |
() => import()
svelte-retag
doesnot work with await import
statement
Sounds great :D |
Ok, see #32. For now though, I'd suggest you try the following:
|
This works. I wrote this type of codes before but forgot about the default part. |
Hey one more thing. Can svelteRetag({
css: import('./app.css?inline')
}); This would be seriously awesome |
Not sure; if that's a feature you'd seriously like to have, please submit an issue for that (feature template) and explain it in detail if you can. Just note that any implementation for this needs to support all the existing features (light + shadow, including compilation targets: Wish I could answer your Q off hand, however. |
p.s. Please feel free to contribute as well. I appreciate the interest! It's a lot of work to help, especially for anything outside of my own use case (which triggered creation of this library) and PR's are welcome as long as they can conform. I don't have a contributions doc yet but essentially everything must have unit tests and of course cannot break any existing use cases. |
Fair enough, i will explain in detail shortly ( in the morning..perhaps )
Thanks :D, I also would like to contribute to this project myself. |
K. If possible, let's please ensure that the scope is limited only to those things which are either actual bugs with Right now just be warned that I'm already sort of at my limit in terms of time, bandwidth and mental capacity. 😞 So, there's not much room for much else beyond that (even reviewing these tickets can be a bit draining). |
Btw @baseplate-admin QQ for you: When you invoke |
Never mind! Scratch that... looks like that's happening via Vite's async module loading magic. That is: const modules = import.meta.glob('./src/**/*.svelte'); Results in the following compiled output (and includes the CSS file, e.g. let modules = Object.assign({
'./src/hello-world.svelte': () => preload(() => import('./hello-world-fbb45795.js'), [
'./hello-world-fbb45795.js',
'./some-other-dependency-5181c010.js',
'./hello-world-baa746fb.css'
], import.meta.url),
}); |
Hi sorry for late response,
I import
Not at all, but i ideally would like for tailwind to be supported when |
Describe the bug
If i import component using
await import
, the import doesn't work.Reproduction
So lets consider these samples :
This works :
This doesn't work :
Logs
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: