poppinss / indicative

Indicative is a simple yet powerful data validator for Node.js and browsers. It makes it so simple to write async validations on nested set of data.
https://indicative.adonisjs.com/
MIT License
417 stars 52 forks source link

Failed to minify the code from this file: #164

Closed niradler closed 6 years ago

niradler commented 6 years ago

Failed to minify the code from this file:

    ./node_modules/indicative/builds/main.js:1:4062

Read more here: http://bit.ly/2tRViJ9

while running react build

niradler commented 6 years ago

https://babeljs.io/repl/ convert main.js with babel fix it

thetutlage commented 6 years ago

Cannot understand what you really mean?

Why would you process your node_modules via babel? There are already transpiled

niradler commented 6 years ago

step to reproduce create-react-app.cmd validator-test npm i indicative --save add import Validator from 'indicative' to App.js yarn build

There are already transpiled /node_modules/indicative/builds/main.js:1:4062 this file isnt, there is let in this line

thetutlage commented 6 years ago

Tried with this webpack config and it works fine.

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

module.exports = {
  entry: path.join(__dirname, './app.js'),

  output: {
    path: path.resolve(__dirname),
    filename: 'app.bundle.js'
  },

  module: {
    rules: [
      {
        test: /\.js$/,
        exclude: /(node_modules|bower_components)/,
        use: {
            loader: 'babel-loader',
            options: {
                presets: ['babel-preset-env']
            }
        }
      }
    ]
  },
  plugins: [
    new UglifyJsPlugin()
  ]
}

Also make sure the react app uses https://www.npmjs.com/package/uglify-es

thetutlage commented 6 years ago

@niradler Have u tried it?

niradler commented 6 years ago

I'm skiing in the moment, so only next week

niradler commented 6 years ago

@thetutlage what exactly do you need me to check ? in order to change the react config file i need to eject and i prefer not to do that.

thetutlage commented 6 years ago

In that case in don’t think I can do much, since all works fine with a simple webpack + UglifyJs plugin, so if create react app does something different, then u need to tell me that

thetutlage commented 6 years ago

Closing since not actionable