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

How to deploy for production? #13

Closed
mewben opened this issue Feb 8, 2015 · 6 comments
Closed

How to deploy for production? #13

mewben opened this issue Feb 8, 2015 · 6 comments

Comments

@mewben
Copy link

mewben commented Feb 8, 2015

No description provided.

@gaearon
Copy link
Owner

gaearon commented Feb 8, 2015

Normally you'll have a separate Webpack config for production. You would remove hot replacement plugin and references to dev server there, and instead add Uglify minification plugin. Then, you'd run webpack --config webpack.production.js to build.

@cocodrino
Copy link

Hi @gaearon and @mewben , I've similar question, in my webpack config I did something like this

var PROD = JSON.parse(process.env.PROD_DEV || "0");
module.exports = {
    devtool: 'eval',
    entry: PROD ?
        [
        'webpack-dev-server/client?http://localhost:3000',
        'webpack/hot/only-dev-server',
        './scripts/index'
    ]
    :
     ["./scripts/index"]
    ,
    output: {
        path: path.join(__dirname, 'build'),
        filename: PROD ? "bundle.min.js" : 'bundle.js',
        publicPath: '/scripts/'
    },
    plugins: PROD ?
        [
            new webpack.HotModuleReplacementPlugin(),
            new webpack.NoErrorsPlugin(),
            (new webpack.optimize.UglifyJsPlugin({minimize: true}))
        ]
        :
        [
            new webpack.HotModuleReplacementPlugin(),
            new webpack.NoErrorsPlugin()
        ]

then I run PROD_DEV=1 webpack..this generate the minified file but I notice than this still is doing request to my dev server

GET http://localhost:3000/socket.io/?EIO=3&transport=polling&t=1441324914560-29 net::ERR_CONNECTION_REFUSED

am I missing disable the server in some place?...my config file doesnt seems have other reference to the server

@nimamehanian
Copy link

+1

@tkh44
Copy link

tkh44 commented Mar 4, 2016

"0" would be truthy. You can just do var PROD = !!process.env.PROD_DEV

@gaearon
Copy link
Owner

gaearon commented Mar 6, 2016

Yep, that’s the problem.

@gaearon
Copy link
Owner

gaearon commented Apr 18, 2016

Let’s track in #63.

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

No branches or pull requests

5 participants