Ændring af build-tilstand i konfigurationsfilen i Webpack
Build-tilstanden reguleres i konfigurationsfilen
ved hjælp af indstillingen
mode. Lad os angive udviklingstilstanden:
export default {
mode: 'development',
entry: './src/index.js',
};
Og nu angiver vi productionstilstanden:
export default {
mode: 'production',
entry: './src/index.js',
};
Byg projektet i udviklingstilstand. Åbn bundtfilen i editoren. Studer den. Husk størrelsen på denne fil.
Byg projektet i productionstilstand. Åbn bundtfilen i editoren. Studer den. Sammenlign filstørrelsen med størrelsen på buildet i udviklingstilstand.