Skip to content

next export builds, but errors in client… #2562

@remy

Description

@remy
  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

Client side routing, navigation and routing would work.

Current Behavior

Ran next export and when I serve locally (and online) there's a client side JavaScript error that breaks all the client side logic.

Without sourcemaps (or any other debugging tools?) I can't work out what's happening. Live URL: https://dkfyjniin9u60.cloudfront.net/ (see console in browser).

Not sure I can replicate as yet, as it's larger site - pretty sure the vanilla examples work.

Context

Including the next.config.js - possibly this is factoring?

const { env } = process;
const webpack = require('webpack');

module.exports = {
  exportPathMap () {
    // we fetch our list of posts, this allow us to dynamically generate the exported pages
    const all = require('./server/lib/docs');

    // transform the list of posts into a map of pages with the pathname `/post/:id`
    const pages = all.posts.docs.reduce((pages, post) =>
      Object.assign({}, pages, {
        [`${post.url}`]: {
          page: '/_post',
          query: { slug: post.slug }
        }
      }),
    {});

    // combine the map of post pages with the home
    return Object.assign({}, pages, {
      '/': { page: '/' }
    });
  },

  webpack: function (config) {
    // this exposes everything on process.env.X
    const webpackEnv = Object.keys(env).reduce((acc, curr) => {
      acc[`process.env.${curr}`] = JSON.stringify(env[curr]);
      return acc;
    }, {});

    config.plugins.push(new webpack.DefinePlugin(webpackEnv));

    return config;
  }
};

Your Environment

Tech Version
next 3.0.1-beta.13
node 8.1.0
OS Mac 10.10.3 (14D136)
browser Chrome Version 61.0.3156.0 (Official Build) canary (64-bit)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions