Comments (9)
Start a new pull request in StackBlitz Codeflow.
from vite.
I also have an issue with the import-analysis.
In my project i get this warning:
[vite] warning:
[ng] C:/[project path]/src/.angular/cache/17.3.7/vite/deps/chunk-CK32LNO7.js
[ng] 2757| return i[n];
[ng] 2758| }
[ng] 2759| return import("./".concat(a, ".entry.js").concat("")).then(function(e2) {
[ng] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[ng] 2760| {
[ng] 2761| cmpModules.set(a, e2);
[ng] The above dynamic import cannot be analyzed by Vite.
[ng] See https://github.com/rollup/plugins/tree/master/packages/dynamic-import-vars#limitations for supported dynamic import formats. If this is intended to be left as-is, you can use the /* @vite-ignore */ comment inside the import() call to suppress this warning.
[ng]
[ng] Plugin: vite:import-analysis
[ng] File: C:/[project path]/src/.angular/cache/17.3.7/vite/deps/chunk-CK32LNO7.js?v=10cb471d
This import should be legit while starting with "./" I do not think there is much I can do here while that code is automatically generated.
I can do as suggested to add the "/* @vite-ignore */" part. And that does remove the warning but only untill angular decides to update its cache or i install the project on another machine.
I was on vite 5.1.4 and now tried to update it to 5.2.11 with the same result.
from vite.
I also have an issue with the import-analysis. In my project i get this warning:
[vite] warning: [ng] C:/[project path]/src/.angular/cache/17.3.7/vite/deps/chunk-CK32LNO7.js [ng] 2757| return i[n]; [ng] 2758| } [ng] 2759| return import("./".concat(a, ".entry.js").concat("")).then(function(e2) { [ng] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [ng] 2760| { [ng] 2761| cmpModules.set(a, e2); [ng] The above dynamic import cannot be analyzed by Vite. [ng] See https://github.com/rollup/plugins/tree/master/packages/dynamic-import-vars#limitations for supported dynamic import formats. If this is intended to be left as-is, you can use the /* @vite-ignore */ comment inside the import() call to suppress this warning. [ng] [ng] Plugin: vite:import-analysis [ng] File: C:/[project path]/src/.angular/cache/17.3.7/vite/deps/chunk-CK32LNO7.js?v=10cb471d
This import should be legit while starting with "./" I do not think there is much I can do here while that code is automatically generated. I can do as suggested to add the "/* @vite-ignore */" part. And that does remove the warning but only untill angular decides to update its cache or i install the project on another machine.
I was on vite 5.1.4 and now tried to update it to 5.2.11 with the same result.
ignoring it is not a resolution, I need to bundle them correctly and chunk for each css should be created
from vite.
I updated the issue to clarify expectations
from vite.
might be related #14102
from vite.
ooo please.... seems its only works this way
https://github.com/spamshaker/vite-css-bundling-issue/blob/working/src/theme-loader.ts
Now those two chunks have been created and finally can be reached in runtime:
dist/assets/theme-dark-6jg3YJQ8.css 0.03 kB │ gzip: 0.04 kB
dist/assets/theme-light-DdXo6UAR.css 0.03 kB │ gzip: 0.04 kB
full output I got:
npm run build && npm run preview
> [email protected] build
> tsc && vite build
vite v5.2.11 building for production...
✓ 39 modules transformed.
dist/index.html 0.44 kB │ gzip: 0.29 kB
dist/assets/react-CHdo91hT.svg 4.13 kB │ gzip: 2.05 kB
dist/assets/theme-dark-6jg3YJQ8.css 0.03 kB │ gzip: 0.04 kB
dist/assets/theme-light-DdXo6UAR.css 0.03 kB │ gzip: 0.04 kB
dist/assets/index-DiwrgTda.css 1.39 kB │ gzip: 0.72 kB
dist/assets/index-Bu5yqxi-.js 144.72 kB │ gzip: 46.79 kB
✓ built in 345ms
> [email protected] preview
> vite preview
➜ Local: http://localhost:4173/
➜ Network: use --host to expose
➜ press h + enter to show help
from vite.
Does anyone know if this is gonna be like that or it it's going to be fixed?
from vite.
here is exactly what I needed and it seems to be working
this means that it loads it in appropriate way - switch/case is enough in my case. I have put it into node_modules to ensure that it can be bundled when the css is provided as a library
as for the import.meta.glob
- it works, however it is not part of any ECMA or tc39 proposals (or I just didn't find it) so I would treat it as a workaround.
At this stage if no objection the Issue could be closed, or the documentation would need to be updated as I saw there are opened couple of similar issues like
from vite.
I'm having a similar issue (I think) with Vue single file components dynamically loaded via Vite import.meta.glob
.
In production, dynamically loaded components are missing a lot of CSS styles. There is no issue when running vite in dev mode.
As suggested in #10630, this seems to be triggered by the cssCodeSplit: true
build option, so cssCodeSplit: false
might be a workaround.
from vite.
Related Issues (20)
- lib打包模式,能否跟webpack一样,可以使用split chunks打包出一堆碎文件。
- Environment variable value not reloading when ".env changed, restarting server..." if process.env. is mutated once HOT 1
- Aliases are not resolved for CSS URLs with fragments HOT 1
- vite 打包出来的defineAsyncComponent异步加载文件不携带referrer HOT 2
- Generated an empty chunk: "lodash-unified" HOT 2
- Generated an empty chunk: "lodash-unified" HOT 1
- How do I use ENV variables in static .js files?
- SyntaxError: Identifier 'global' has already been declared while importing a json file with "global" key in SSR environment HOT 1
- Support Vanilla JS CSS Modules / CSS import attributes HOT 1
- css局部样式只限定格式为.module.的文件,无法手动配置,希望能用globalModulePaths属性进行判断 HOT 1
- 通过 raw 引入 ts 模块,代码未编译 HOT 3
- Globals are not accessible in a service worker
- When referencing an environment variable that doesnt exist, vite dumps your whole environment into the bundle as an object HOT 2
- Consider routers in Vite's development HOT 1
- bug: vite binary crashes during hosting a static build
- bug: Inconsistent path separator in resolveId() on Windows HOT 1
- Fail to import default from a commonjs package like hammerjs from a file in node_modules with optimizeDeps.exclude config HOT 1
- await build api doesnot finish build when watch is setted to {} HOT 4
- Does not see file changes when using envDir HOT 2
- Support `additionalData` for the lightningcss css transformer
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 vite.