Add "uglifyjs-webpack-plugin" reduced app.js from 12 MB to 2 MB #2324

pull/2650/head^2
Julio Montoya 6 years ago
parent e9bdd4e256
commit 35f56a3419
  1. 1
      package.json
  2. 2
      src/ThemeBundle/Resources/views/Layout/head.html.twig
  3. 8
      webpack.config.js

@ -41,6 +41,7 @@
"select2": "^4.0.6-rc.1",
"simplewebrtc": "^3.0.1",
"timeago": "^1.6.3",
"uglifyjs-webpack-plugin": "^1.3.0",
"webcamjs": "^1.0",
"webpack-jquery-ui": "^1.0.0"
}

@ -37,8 +37,6 @@
{% set profile_link = '' %}
{% set message_link = '' %}
{# Files vendor.css is generated automatically by the css generated when reading vendor.js #}
<link rel="stylesheet" href="{{ asset('build/vendor.css') }}"/>
{# Files app.css is generated from "assets/css/app.scss" file using the file webpack.config.js #}
<link rel="stylesheet" href="{{ asset('build/css/app.css') }}"/>
<link rel="stylesheet" href="{{ asset('build/css/themes/'~ theme ~'/default.css') }}"/>

@ -1,6 +1,7 @@
var Encore = require('@symfony/webpack-encore');
var copyWebpackPlugin = require('copy-webpack-plugin');
var webpack = require('webpack');
const Encore = require('@symfony/webpack-encore');
const copyWebpackPlugin = require('copy-webpack-plugin');
const webpack = require('webpack');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
Encore
.setOutputPath('public/build/')
@ -32,6 +33,7 @@ Encore
.addStyleEntry('css/responsive', './assets/css/responsive.css')
.addStyleEntry('css/scorm', './assets/css/scorm.css')
.addPlugin(new UglifyJsPlugin())
.enableSourceMaps(!Encore.isProduction())
.autoProvideVariables({
$: 'jquery',

Loading…
Cancel
Save