2017-03-06 6 views
0

Wie kann ich meine Bundle-Ausgabedatei minimieren? Ich versuche, mit dieser Konfiguration: linkWebpack 2 Minimieren - LoaderOptionsPlugin

new webpack.LoaderOptionsPlugin({ 
    minimize: true, 
    debug: false, 
    options: { 
    context: __dirname 
    } 
}) 

Aber meine Bundle-Datei gleich groß bleiben, wie es war.

+0

Ich habe das gleiche. Hast du dieses Problem gelöst? – Vovan

+0

Schau meine Antwort. – Klark

Antwort

0

Hier ist was ich getan habe und es hat funktioniert. Zuerst habe ich hinzufügen UglifyJsPlugin in webpack Konfiguration:

new webpack.optimize.UglifyJsPlugin({ 
    compress: { warnings: false } 
}) 

Problem war, dass ich nicht alle babel Pakete installiert hatte:

"babel": "^6.23.0", 
"babel-core": "^6.23.1", 
"babel-loader": "^6.3.0", 
"babel-preset-env": "^1.6.0", 
"babel-preset-stage-3": "^6.22.0", 
"babel-register": "^6.22.0", 

Und in .babelrc Datei Konfiguration:

{ 
    "presets": ["es2015", "stage-3"], 
    "compact" : false 
} 

Hoffnung es wird jemandem helfen.