2016-05-06 5 views
0

英雄に展開すると、「npm run start」を実行したときとは全く異なるサイト が表示されます。Herokuは完全に異なるアプリケーションを展開します

どうしてですか?

私はReact + Webpack + Expressを実行しています。表示されているサイトは、私がスターターパッケージとして使用したサイトですので、Herokuを間違って誘導しているサイトに焼き上げられたコード行があると推測しています。私はそれを見つけることができません。これは私のレポです:https://github.com/adamskriger/calendar/

これは私のwebpack.config.jsです。

const path = require('path'); 
const merge = require('webpack-merge'); 
const webpack = require('webpack'); 
const NpmInstallPlugin = require('npm-install-webpack-plugin'); 
const TARGET = process.env.npm_lifecycle_event; 

const HtmlWebpackPlugin = require('html-webpack-plugin'); 
const CleanPlugin = require('clean-webpack-plugin'); 
const ExtractTextPlugin = require('extract-text-webpack-plugin'); 

const pkg = require('./package.json'); 

const PATHS = { 
    app: path.join(__dirname, 'app'), 
    build: path.join(__dirname, 'build') 
}; 

process.env.BABEL_ENV = TARGET; 

const common = { 
    entry: { 
    app: PATHS.app 
    }, 
    // Add resolve.extensions 
    // '' is needed to allow imports without an extension 
    // note the .'s before the extension as it will fail to load without them 
    resolve: { 
    extensions: ['', '.js', '.jsx', '.json'] 
    }, 
    output: { 
    path: PATHS.build, 
    filename: 'bundle.js' 
    }, 
    module: { 
    loaders: [ 
     { 
     // Test expects a RegExp! Notethe slashes! 
     test: /\.css$/, 
     loaders: ['style', 'css'], 
     //Include accepts either a path or an array of paths 
     include: PATHS.app 
     }, 
     //set up JSX. This accepts js too thanks to RegExp 
     { 
     test: /\.(js|jsx)$/, 
     //enable caching for improved performance during development 
     //It uses default OS directory by default. If you need something more custom, 
     //pass a path to it. ie: babel?cacheDirectory=<path> 
     loaders: [ 
     'babel?cacheDirectory,presets[]=es2015' 
    ], 
     //parse only app files Without this it will go thru the entire project. 
     //beside being slow this will likely result in an error 
     include: PATHS.app 
     } 
    ] 
    } 
}; 

// Default configuration. We will return this if 
// Webpack is called outside of npm. 
if(TARGET === 'start' || !TARGET){ 
    module.exports = merge(common, { 
    devtool: 'eval-source-map', 
    devServer: { 
     contentBase: PATHS.build, 

     //enable history API fallback so HTML5 HISTORY API based 
     // routing works. This is a good default that will come in handy in more 
     // complicated setups. 
     historyApiFallback: true, 
     hot: true, 
     inline: true, 
     progress: true, 

     //display only errors to reduce output amount 
     stats: 'errors only', 

     //Parse host and port from env so this is easy to customize 
     host: process.env.HOST, 
     port: process.env.PORT 

}, 

plugins: [ 
    new webpack.HotModuleReplacementPlugin(), 
    new NpmInstallPlugin({ 
    save: true //--save 
    }) 
] 
}); 
} 

if(TARGET === 'build' || TARGET === 'stats') { 
    module.exports = merge(common, { 
    entry: { 
     vendor: Object.keys(pkg.dependencies).filter(function(v) { 
     return v !== 'alt-utils'; 
     }), 
     style: PATHS.style 
    }, 
    output: { 
     path: PATHS.build, 
     // Output using entry name 
     filename: '[name].[chunkhash].js', 
     chunkFilename: '[chunkhash].js' 
    }, 
    module: { 
     loaders: [ 
     // Extract CSS during build 
     { 
      test: /\.css$/, 
      loader: ExtractTextPlugin.extract('style', 'css'), 
      include: PATHS.app 
     } 
     ] 
    }, 
    plugins: [ 
     new CleanPlugin([PATHS.build]), 
     // Output extracted CSS to a file 
     new ExtractTextPlugin('[name].[chunkhash].css'), 
     // Extract vendor and manifest files 
     new webpack.optimize.CommonsChunkPlugin({ 
     names: ['vendor', 'manifest'] 
     }), 
     // Setting DefinePlugin affects React library size! 
     new webpack.DefinePlugin({ 
     'process.env.NODE_ENV': '"production"' 
     }), 
     new webpack.optimize.UglifyJsPlugin({ 
     compress: { 
      warnings: false 
     } 
     }) 
    ] 
    }); 
} 

これは私のpackage.jsonです:あなたはHerokuのにデプロイする場合、それはノード環境が「生産」に設定されているだから

{ 
    "name": "Portfolio", 
    "version": "1.0.0", 
    "description": "Portfolio Site", 
    "main": "server.js", 
    "scripts": { 
    "build": "webpack", 
    "start": "webpack-dev-server" 
    }, 
    "author": "Adam Kriger", 
    "license": "ISC", 
    "devDependencies": { 
    "babel-core": "^6.7.7", 
    "babel-loader": "^6.2.4", 
    "babel-preset-es2015": "^6.6.0", 
    "babel-preset-react": "^6.5.0", 
    "babel-preset-react-hmre": "^1.1.1", 
    "css-loader": "^0.23.1", 
    "npm-install-webpack-plugin": "^3.0.0", 
    "style-loader": "^0.13.1", 
    "webpack": "^1.13.0", 
    "webpack-dev-server": "^1.14.1", 
    "webpack-merge": "^0.12.0" 
    }, 
    "dependencies": { 
    "alt": "^0.18.4", 
    "alt-container": "^1.0.2", 
    "alt-utils": "^1.0.0", 
    "babel-core": "^6.7.7", 
    "babel-loader": "^6.2.4", 
    "babel-preset-es2015": "^6.6.0", 
    "babel-preset-react": "^6.5.0", 
    "babel-preset-react-hmre": "^1.1.1", 
    "babel-preset-survivejs-kanban": "^0.3.3", 
    "body-parser": "^1.15.0", 
    "bootstrap": "^3.3.6", 
    "classnames": "^2.2.5", 
    "clean-webpack-plugin": "^0.1.9", 
    "components": "^0.1.0", 
    "css-loader": "^0.23.1", 
    "express": "^4.13.4", 
    "extract-text-webpack-plugin": "^1.0.1", 
    "firebase": "^2.4.2", 
    "html-webpack-plugin": "^2.16.0", 
    "json-loader": "^0.5.4", 
    "moment": "^2.13.0", 
    "morgan": "^1.7.0", 
    "node-uuid": "^1.4.7", 
    "npm-install-webpack-plugin": "^3.0.0", 
    "react": "^15.0.1", 
    "react-dom": "^15.0.2", 
    "react-router": "^2.4.0", 
    "reactfire": "^0.7.0", 
    "style-loader": "^0.13.1", 
    "webpack": "^1.13.0", 
    "webpack-dev-server": "^1.14.1", 
    "webpack-merge": "^0.12.0" 
    } 
} 

答えて

0

、それはあなたのコンパイル、ビルドを探します。あなたが古いバージョンのビルドをwebpackに送ってほしいと決めた場所にまだビルドしている可能性は非常に高いです。あなたのケースでは、これはどこですか:

build: path.join(__dirname, 'build') 

あなたの古いウェブサイトがどこにあるのですか。私はここですべてを削除し、別のコンパイルを行います。それからもう一度herokuにやります。

+0

ありがとうございました!私はそれを働かせた。私のビルドファイルはGithubにプッシュされておらず、Herokuは間違ったファイルを参照していました。 – CodeYogi

関連する問題