Comments (23)
You can also try it with vite
instead webpack
: https://quasar.dev/start/vite-plugin (wait reload prompt from the PWA, maybe you get a 404)
from unplugin-auto-import.
node v14.17.4
from unplugin-auto-import.
Hii @userquin thank for your patience here is the repo https://github.com/soulsam480/unplugin-bundle-reproduce I've added the steps in readme. Thanks
from unplugin-auto-import.
@soulsam480 the size of vue seems to be correct, just mouse over @vue
on the browser, you'll see something this:
from unplugin-auto-import.
If you add 452.75Kb
of quasar
to the 196Kb
original vendors we get ~ 680Kb
vendors chunk:
from unplugin-auto-import.
without unplugin-auto-import
:
from unplugin-auto-import.
But it doesn't add the the full esm prod bundle without the plugin. Do you think it's kind of conflicting with the plugin? I mean the tree shaking of quasar conflicting with the plugin in any way?
Try file an issue on quasar
repo, maybe there can address this, or wait to @antfu
review.
from unplugin-auto-import.
@soulsam480 try adding unplugin-vue-components
, see:
from unplugin-auto-import.
Hii this is a Quasar CLI project, and I can't migrate to a vite based project, this is a pretty huge one. Is it a known issue ? I mean the bundle size ?
from unplugin-auto-import.
I think it is a problem with webpack + quasar and treeshaking (use import { QBtn, ... } from 'quasar'
, I have never use quasar), for exmaple using vuetify 2 with vue cli the initial/vendor chunk is huge since you need a few components.
from unplugin-auto-import.
I think it is a problem with webpack + quasar and treeshaking (use
import { QBtn, ... } from 'quasar'
, I have never use quasar), for exmaple using vuetify 2 with vue cli the initial/vendor chunk is huge since you need a few components.
But here in my case, auto-import only handles vue, vue-router and quasar API (excluding components). So I'm assuming this is an issue with the handling of tree shaking in API imports. From the config I believe this should be the expected behavior right ?
from unplugin-auto-import.
I think it is a problem with webpack + quasar and treeshaking (use
import { QBtn, ... } from 'quasar'
, I have never use quasar), for exmaple using vuetify 2 with vue cli the initial/vendor chunk is huge since you need a few components.
Another reason this is not an issue with quasar tree shaking of components -> without the plugin the bundle size is less and in both the scenarios quasar handles auto-importing and tree shaking of components.
from unplugin-auto-import.
@antfu Hii, any help on this ?
from unplugin-auto-import.
@soulsam480 can you provide a repro?
from unplugin-auto-import.
@soulsam480 can you provide a repro?
Sure let me setup a repo quickly
from unplugin-auto-import.
@soulsam480 I'll try to take a look later, too busy at work (4/5 hours)...
Provide also node version used.
from unplugin-auto-import.
Seems the problem is quasar
, it is adding the full esm-prod
version, just add webpack-bundle-analyzer
on your project on main
branch: yarn add -D webpack-bundle-analyzer
then configure it before unplugin-auto-import
plugin, then run yarn build
, the analyzer will open the result on browser:
...
chainWebpack(chain) {
chain.plugin('webpack-bundle-analyzer').use(new BundleAnalyzerPlugin())
chain.plugin('unplugin-auto-import').use(
AutoImportPlugin({...})
);
},
...
This entry vendor.f42cad09.js │ 687.44 KB
contains this (see below the output for auto-import
):
Your version with auto-import
:
╔═════════════════════╤═══════════╤═══════════╗
║ Asset │ Size │ Gzipped ║
╟─────────────────────┼───────────┼───────────╢
║ app.31d6cfe0.css │ 0.00 KB │ 0.02 KB ║
║ vendor.8ba9cf3e.css │ 184.17 KB │ 33.20 KB ║
╟─────────────────────┼───────────┼───────────╢
║ 31.4239d4f1.js │ 3.48 KB │ 1.39 KB ║
║ 608.2c8e64bf.js │ 43.53 KB │ 2.81 KB ║
║ 992.fc4fa29d.js │ 0.77 KB │ 0.50 KB ║
║ app.e6709996.js │ 4.26 KB │ 2.10 KB ║
║ vendor.f42cad09.js │ 687.44 KB │ 213.16 KB ║
╚═════════════════════╧═══════════╧═══════════╝
without auto-import
:
╔═════════════════════╤═══════════╤══════════╗
║ Asset │ Size │ Gzipped ║
╟─────────────────────┼───────────┼──────────╢
║ app.31d6cfe0.css │ 0.00 KB │ 0.02 KB ║
║ vendor.8ba9cf3e.css │ 184.17 KB │ 33.20 KB ║
╟─────────────────────┼───────────┼──────────╢
║ 293.6baa7543.js │ 0.77 KB │ 0.50 KB ║
║ 592.770280ee.js │ 3.49 KB │ 1.39 KB ║
║ 948.05ae9432.js │ 43.47 KB │ 2.81 KB ║
║ app.bcf23d9f.js │ 4.29 KB │ 2.12 KB ║
║ vendor.2149e36a.js │ 196.28 KB │ 68.34 KB ║
╚═════════════════════╧═══════════╧══════════╝
from unplugin-auto-import.
But it doesn't add the the full esm prod bundle without the plugin. Do you think it's kind of conflicting with the plugin? I mean the tree shaking of quasar conflicting with the plugin in any way?
from unplugin-auto-import.
I don't know.
The unplugin-auto-import
use typeof import('quasar')['useQuasar']
and seems it is resolved from the esm
, then added to the dist?.
/cc @antfu can you take a look at this?
from unplugin-auto-import.
I don't know.
The
unplugin-auto-import
usetypeof import('quasar')['useQuasar']
and seems it is resolved from theesm
, then added to the dist?./cc @antfu can you take a look at this?
No problem. Let's wait for him to review
from unplugin-auto-import.
@antfu Hey, can you help on this, please
from unplugin-auto-import.
Some additional information to see if that might help solving the issue: if you just use useQuasar() from your pages or components, the esm.prod isn't added to the bundle.
However, if you do declare it as a lookup in the auto-import config, it'll add it.
from unplugin-auto-import.
All this plugin does is injecting the import statements for the modules and nothing else. I believe this is more like a bundler or deps resolving issue. I am open for PR that fix the preset if there is anything missing, otherwise, this is considered out-of-scope.
from unplugin-auto-import.
Related Issues (20)
- Can't get auto import of NuxtIcons to work
- How to transform package code in node_modules? HOT 1
- Auto imports doesn't work in script setup template HOT 5
- Wildcard import stopped working HOT 1
- "readonly" is imported from external module "vue" but never used
- Inconsistency with Auto Imports and Typescript ESM Imports HOT 1
- Cannot auto import types HOT 2
- How to exclude a file in the dirs configuration folder?
- 1
- 支持 pinia 自动导入支持类型推导 HOT 3
- Export a `AutoImportResolver` to generate a `SupportAutoImport` function for libs. HOT 1
- 无法在 `interface` 中使用类型导入
- Cannot access 'xxx' before initialization HOT 1
- 'defaultExportByFilename' seems to be on by default and cannot be turned off
- Cannot exclude stories.ts file from auto import HOT 1
- If imports receives a two-dimensional array object format implemented as a function, it will report a type error. HOT 1
- Auto Import for CSS/SCSS Files in NextJS
- eslint最新版本8.57.0中配置eslint.config.js,无法处理json的导入
- [Question] How can vscode IDE know the auto-imports HOT 1
- Can we update the docs to add 'allowSyntheticDefaultImports'
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 unplugin-auto-import.