Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow skipping assets optimization #158

Merged

Conversation

archdragon
Copy link
Contributor

@archdragon archdragon commented Jun 14, 2020

Added changes

Based on our discussion in #154 I propose using NODE_ENV to skip assets minification when necessary.

NODE_ENV=development mix dev will run webpack in development mode - in this mode minification steps are ignored.

This allows us to easily debug JS code.

Default NODE_ENV=development
image image

Comment/Question

Typically we would expect webpack to run in development mode by default and switch to production when necessary (ie. during deployment).

I just didn't want to mess with our current workflow - if I changed the default to development we would have to remember to always build assets in production mode before submitting them.

Or maybe it's not a big deal and I should just use development as the default env?

Resolves #150

@archdragon archdragon requested a review from mcrumm June 14, 2020 19:56
@archdragon archdragon mentioned this pull request Jun 14, 2020
@lukaszsamson
Copy link

I don't see how this can help debugging live_dashboard JS when live_dashboard is a dependancy. In that case the JS code is taken from priv/static and is already minified. Besides, the client application may not even use webpack at all.
In NodeJS world libraries come either not minified or minified with source maps. Why not distribute source maps here?

@josevalim
Copy link
Member

Yes, if you want to debug it, then you need to swap to a path dependency and recompile it locally. We can add more information to the README.

@josevalim
Copy link
Member

@lukaszsamson there is more information here on why the usual source maps approach does not work for us: #154

@lukaszsamson
Copy link

I've read the discussion in #154 and it's not evident what is the reason against providing inlined source maps? 400kB is not much for an internal administration panel (in my experience a medium sized Angular SPA easily reaches 30MB in dev mode while working smooth). Building two separate bundles for dev and prod is also an option.

@josevalim
Copy link
Member

If you want to send a PR that builds two bundles and then used a flag to control which, we would love to take a look at it. Thanks!

@josevalim josevalim merged commit 7aa5ac2 into phoenixframework:master Sep 28, 2020
@josevalim
Copy link
Member

💚 💙 💜 💛 ❤️

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

Successfully merging this pull request may close these issues.

Add JS sourcemaps
3 participants