Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Heroku 网页包配置未导出对象_Heroku_Webpack_Webpack 2_Survivejs - Fatal编程技术网

Heroku 网页包配置未导出对象

Heroku 网页包配置未导出对象,heroku,webpack,webpack-2,survivejs,Heroku,Webpack,Webpack 2,Survivejs,网页@2.2 WEBPACK-MERGE@2.4 我正在使用webpack merge进行智能开发或生产配置 我的开始脚本看起来像 } "scripts": { "start": "webpack --env=production & node start.js", "dev": "webpack-dev-server --env=dev", }, 我的网页包配置如下所示: const webpack = require('webpack') const ExtractText

网页@2.2 WEBPACK-MERGE@2.4

我正在使用webpack merge进行智能开发或生产配置

我的开始脚本看起来像

}
"scripts": {
  "start": "webpack --env=production & node start.js",
  "dev": "webpack-dev-server --env=dev",
},
我的网页包配置如下所示:

const webpack = require('webpack')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const CompressionPlugin = require('compression-webpack-plugin')
const webpackMerge = require('webpack-merge')

const baseConfig = function(env) {
  return {
    output: {
      path: '/public/',
      filename: 'index.js',
      publicPath: '/public/',
    },
    module: {
      rules: [
        {
          test: /\.js$/,
          exclude: /node_modules/,
          use: ['babel-loader'],
        },
        {
          test: /\.css$/,
          loader: ExtractTextPlugin.extract({
            fallbackLoader: "style-loader",
            loader: "css-loader",
            publicPath: "/public/",
          }),
        },
      ],
    },
    resolve: {
      extensions: ['.js', '.css'],
    },
    plugins: [
      new webpack.DefinePlugin({
        'process.env': { NODE_ENV: JSON.stringify(env) },
      }),
      new ExtractTextPlugin({
        filename: "bundle.css",
        disable: false,
        allChunks: true,
      }),
    ],
  }
}

module.exports = function(env) {
  return webpackMerge(baseConfig(env), env === 'dev' ? {
    devtool: 'cheap-module-source-map',
    entry: [
      'react-hot-loader/patch',
      'webpack-dev-server/client?http://localhost:8080',
      'webpack/hot/only-dev-server',
      './app/index.js',
    ],
    devServer: {
      hot: true,
      publicPath: '/public/',
      proxy: {
        "/api/**": "http://localhost:3333",
        "/auth/**": "http://localhost:3333",
      },
    },
    plugins: [
      new webpack.HotModuleReplacementPlugin(),
      new webpack.NamedModulesPlugin(),
    ],
  } : {
    devtool: 'inline-source-map',
    entry: [
      './app/index.js',
    ],
    plugins: [
      new webpack.optimize.UglifyJsPlugin({
        comments: false,
      }),
      new webpack.LoaderOptionsPlugin({
        minimize: true,
      }),
      new webpack.optimize.AggressiveMergingPlugin(),
      new CompressionPlugin({
        asset: "[path].gz[query]",
        algorithm: "gzip",
        test: /\.js$|\.css$|\.html$/,
        threshold: 10240,
        minRatio: 0.8,
      }),
    ],
  })
}
Webpack在本地成功编译,但当我尝试将其部署到heroku时,papertrail中的输出如下所示:

> webpack --env=production & node start.js 
Config did not export an object. 

有什么想法吗?

我也有同样的问题,我忘了安装webpack开发服务器:
npm安装--保存开发人员网页包开发人员服务器


希望有帮助

这是您用于生产的
网页包吗?它看起来像是
dev
的配置,有一个基本配置,然后是一个三元运算符,如果它是生产环境,则使用第二个对象。我遇到了完全相同的错误,但我已经安装了webpack dev server。当我试图为开发人员和生产人员创建多个配置时,出现了这个问题