rubenbp
10/6/2017 - 9:18 AM

Demostración de que ramda v0.24.1 no soporta tree shaking

Demostración de que ramda v0.24.1 no soporta tree shaking

const webpack = require('webpack');
const path = require('path');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');

module.exports = {
  entry: './app.js',
  output: {
    path: path.join(__dirname, 'dist'),
    filename: 'app.min.js' 
  },
  module: {
    rules: [
      {
        test: /\.js$/,
        exclude: /(node_modules|bower_components)/,
        use: {
          loader: 'babel-loader',
          options: {
            presets: [
              ["env", { 
                  "targets": { 
                    "browsers": ["last 2 versions", "ie >= 11"] 
                  },
                  "modules": false
                } 
              ] 
            ]
          }
        }
      }
    ]
  },
  plugins: [
    new UglifyJSPlugin()
  ]
}
{
  "name": "tree-shaking",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "scripts": {
    "build": "webpack"
  },
  "dependencies": {
    "babel-core": "^6.26.0",
    "babel-loader": "^7.1.2",
    "babel-preset-env": "^1.6.0",
    "ramda": "^0.24.1",
    "uglifyjs-webpack-plugin": "^0.4.6",
    "webpack": "^3.6.0"
  }
}
export const foo = () => console.log("foo");
export const noUsar = () => console.log("noUsar");
import { curry } from 'ramda';
import { foo } from './cocotero';

const demo = (foo, bar) => foo + bar;

const demoFoo = curry(demo)('foo ');

console.log(demoFoo('bar'));
node_modules
dist
yarn.lock