Various vendor files for production and development

I am using Phoenix 0.14.0 and I am planning on using reactjs to build a UI.

The way I do it is just paste the response.min.js file into the folder web/static/vendor

. The point is, I want development to use the unminified version of react instead, since it has debug code.

When I use react.min.js

, the final size of the miniature app.js is ~ 150K and if I use react.js

then the final size is 550K, which is a minor difference in my opinion.

Is there a way to use a different static file to build and develop in phoenix?

+3


source to share


1 answer


You can put a regular one react.js

in your project and let a plugin like uglify-js-brunch minify it for you on production builds, or you can put both files there and use overrides

in your branch configurator to include / exclude what you want in depending on your environment. The latter might look something like this:



conventions:
  ignored: [
    /[\\/]_/,
    'web/static/vendor/react.min.js'
  ]
overrides:
  production:
    conventions:
      ignored: [
        /[\\/]_/,
        'web/static/vendor/react.js'
      ]

      

+4


source







All Articles