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

Dist should have source map, min and regular versions #46

Closed
PhiLhoSoft opened this issue Dec 14, 2015 · 7 comments
Closed

Dist should have source map, min and regular versions #46

PhiLhoSoft opened this issue Dec 14, 2015 · 7 comments

Comments

@PhiLhoSoft
Copy link

I just installed ng-redux via Bower. I see a ng-redux.js file in the dist folder, and I thought "there should be a minified version". Then I opened the file, to see it is actually minified...

So, I suggest:

  • To name this file ng-redux.min.js to follow common practices;
  • To create also a source map for easy debugging;
  • And / or to provide a non-minified version of this file. I like to include the non-minified version in debug builds and in tests.
@wbuchwalter
Copy link
Member

👍
I'll try to do that soonish, feel free to make a PR if you can!
Thanks.

@sebald
Copy link

sebald commented Jul 22, 2016

I just tested the minified version. You webpack with redux but not the minified version of redux. This will always cause the following error message to appear:

You are currently using minified code outside of NODE_ENV === 'production'. This means that 
you are running a slower development build of Redux. You can use loose-envify 
(https://github.com/zertosh/loose-envify) for browserify or DefinePlugin for webpack 
(http://stackoverflow.com/questions/30030031) to ensure you have the correct code for your 
production build.

Adding this to the webpack config will solve the issue:

config.resolve.alias = {
  redux: 'redux/dist/redux.min.js'
};

Not quite sure if you can specify this via webpack's CLI.

@jongunter
Copy link

Is there a plan to fix this error? Currently, the minified build in dist throws the error whenever it's used.

@wbuchwalter
Copy link
Member

Hi, please see #140 .

@jongunter
Copy link

jongunter commented Jul 20, 2017

Thanks, I appreciate your efforts on this library. If I had the time, I'd step up and volunteer right away :(

It's not a pretty solution, but I was able to resolve this by patching ng-redux.js to expose the process variable that webpack uses to the global window object.

// shim for using process in browser
    var process = module.exports = {};

    window.process = process; // my ugly patch

Then, in my config block that sets up ng-redux, I put this code:

/// isDevEnvironment is a constant set by our build system
if (!isDevEnvironment && window.process && window.process.env) {
            window.process.env.NODE_ENV = 'production';
}

I'm working on an older project with no module loader/bundler, so there's no possibility of using webpack/browserify plugins to solve this issue.

If anyone has a better solution, I'm all ears.

@jongunter
Copy link

jongunter commented Jul 20, 2017

Just kidding, that didn't work. Apparently the minification check runs before my ng-redux config. I don't want to overwrite the "process" variable by putting my config code before ng-redux. I also don't want to patch ng-redux to run in prod mode all the time.

I'm going to leave it as-is and just live with the error message (and supposed slowness), unless someone can suggest a good solution.

@deini
Copy link
Collaborator

deini commented Sep 1, 2017

Closing in favor of: #158 and #156

@deini deini closed this as completed Sep 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants