The build process outputs optimized files into the dist folder by default.
Final Answer:
dist -> Option B
Quick Check:
Build output folder = dist [OK]
Hint: Look for 'dist' folder after build completes [OK]
Common Mistakes:
Confusing src with output folder
Thinking public folder contains build files
Looking inside node_modules for build output
4. You ran npm run build but the output files are very large. Which of these is NOT a recommended way to reduce the build size?
medium
A. Use code splitting to load parts on demand
B. Remove unused dependencies from the project
C. Disable minification in the build config
D. Analyze bundle size with build report tools
Solution
Step 1: Review optimization techniques
Code splitting, removing unused dependencies, and analyzing bundle size help reduce build size.
Step 2: Understand minification role
Disabling minification increases file size, so it is NOT recommended to reduce build size.
Final Answer:
Disable minification in the build config -> Option C
Quick Check:
Minification off = larger files [OK]
Hint: Minification off makes files bigger, avoid it [OK]
Common Mistakes:
Thinking disabling minification reduces size
Ignoring code splitting benefits
Skipping bundle analysis tools
5. You want to improve your Vue app's production build by lazy-loading a large component only when needed. Which Vue feature helps achieve this during build optimization?
hard
A. Dynamic import with defineAsyncComponent
B. Using v-if to hide the component
C. Registering the component globally in main.js
D. Importing the component normally at the top of the file
Solution
Step 1: Understand lazy loading in Vue
Lazy loading means loading a component only when needed, reducing initial bundle size.
Step 2: Identify correct syntax for lazy loading
Vue supports lazy loading via dynamic import combined with defineAsyncComponent.
Step 3: Evaluate other options
Using v-if only hides the component but does not delay loading. Global registration and normal import load the component eagerly.
Final Answer:
Dynamic import with defineAsyncComponent -> Option A