繁体   English   中英

为什么我的 next.config.js 破坏了我的 heroku 构建?

[英]Why is my next.config.js breaking my heroku build?

我能够在本地运行该项目,但是自从我更改next.config.js文件以包含@zeit/next-css后,我的 heroku 构建失败并出现以下错误。

remote: Error: webpack build failed: found page without a React Component as default export in pages/gql/queries/age-ranges.js

这是我的配置文件的内容。 注释掉的两个部分是我尝试过但也失败的其他配置。

下一步.config.js

const withImages = require('next-images');
const withCSS = require('@zeit/next-css');

module.exports = withCSS(withImages());

// ---- -----

// const withPlugins = require('next-compose-plugins');
// const withCSS = require('@zeit/next-css');
// const withImages = require('next-images');

// const nextConfig = {
//  useFileSystemPublicRoutes: false,
//  webpack: config => {
//      config.node = {
//          fs: 'empty',
//          modules: false
//      };

//      return config;
//  }
// };

// module.exports = withPlugins([withCSS, withImages], nextConfig);

// ----- synapse -----

// const withCSS = require('@zeit/next-css');
// const withImages = require('next-images');
// module.exports = withCSS(withImages());

// module.exports = withCSS(
//  withImages({
//      target: 'serverless',
//      webpack(config) {
//          config.module.rules.push({
//              test: /\.(png|svg|eot|otf|ttf|woff|woff2)$/,
//              use: {
//                  loader: 'url-loader',
//                  options: {
//                      limit: 8192,
//                      publicPath: '/_next/static/',
//                      outputPath: 'static/',
//                      name: '[name].[ext]'
//                  }
//              }
//          });
//          return config;
//      }
//  })
// );

/gql/queries/age-ranges.js

import gql from 'graphql-tag';

export const GET_AGE_RANGES = gql`
    query getAgeRanges {
        allAgeRanges {
            nodes {
                name
                nodeId
                id
            }
        }
    }
`;

发现了问题。 我导入的日历选择器 CSS 抛出错误,但当我将 Next 更新到更新版本时它已修复。 但是当我更新到 next 的“金丝雀”版本时,构建失败了,因为它们需要不同的文件结构。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM