Skip to content
This repository has been archived by the owner on Mar 16, 2020. It is now read-only.

named functions excluded #72

Closed
BernardA opened this issue Jan 2, 2018 · 1 comment
Closed

named functions excluded #72

BernardA opened this issue Jan 2, 2018 · 1 comment

Comments

@BernardA
Copy link

BernardA commented Jan 2, 2018

The plugin seems to exclude all named functions from minified output.

Without minification the named functions exist in the webpack output, but they are no longer there when the plugin is applied.

This is one instance of a function included in myfile.js:

 `function scrollToAnchor(aid) {  
        var aTag = $("a[name='" + aid + "']");
       $('html,body').animate({
           scrollTop: aTag.offset().top
       }, 'slow');
   }
 `

On the same file, this showed up correctly on the minified version:

 `$(document).ready(function() {
       $(document).ajaxSend(function() {
            $("#spinner").show();
       });
      $(document).ajaxStop(function() {
            $("#spinner").hide();
      });
    });
 `

webpack.config.js:

 `const MinifyPlugin = require("babel-minify-webpack-plugin");
   .....
   module.exports = {
       ...
        plugins: [
            new MinifyPlugin(),
       ...
 `

babel.rc

 `{
 "presets": [
 ["env", 
 {
  "modules": false,
  "useBuiltIns": true,
  "targets": {
    "browsers": ["last 2 versions", "safari >= 7"]
  }
 }],
 "react",
 "es2015"
 ],
 "plugins": [
  "transform-object-rest-spread", 
  "transform-react-jsx",
  "transform-runtime"
  ],
"comments": false
  }
 `

Thanks

@alexander-akait
Copy link
Member

@BernardA plugin don't do minification directly, we just use babel-preset-minify, please create issue there. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants