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

next export builds, but errors in client… #2562

Closed
1 task done
remy opened this issue Jul 14, 2017 · 5 comments
Closed
1 task done

next export builds, but errors in client… #2562

remy opened this issue Jul 14, 2017 · 5 comments

Comments

@remy
Copy link
Contributor

remy commented Jul 14, 2017

  • 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)
@CodeOtter
Copy link

CodeOtter commented Apr 12, 2018

Agreeing with OP regarding sourcemaps.

I cannot find any instructions, examples, or insights on how to turn sourcemaps on for any project in Next.js.

Here's a example of outdated, non-applicable, and completely incorrect information about Next.js and source maps:

Without this ability, I will be left with no choice but to abandon using it ever again. I can't fix what I can't see, and without the ability to debug, no other feature NextJS offers is even worth it.

@timneutkens
Copy link
Member

timneutkens commented Apr 13, 2018

I cannot find any instructions, examples, or insights on how to turn sourcemaps on for any project in Next.js.

You can use something like:
https://github.com/zeit/next-plugins/tree/master/packages/next-source-maps

Here's a example of outdated, non-applicable, and completely incorrect information about Next.js and source maps:

Without this ability, I will be left with no choice but to abandon using it ever again. I can't fix what I can't see, and without the ability to debug, no other feature NextJS offers is even worth it.

Just a feeling, but I wanted to express that I personally don't appreciate the wording you're using. You're using an open source library, countless hours have been put into it, for me most of them without getting anything in return.
I only recently started working on it full time.

With comments like these, non-reproducible (you're not providing an example), you're only trying to hurt people, and most maintainers of OSS projects wouldn't even reply / help you with any issues with this kind of tone.

@CodeOtter
Copy link

CodeOtter commented Apr 13, 2018

you're only trying to hurt people,

Since we're now allowed to play psychologist and impose what we think people are trying to do, let's point out a few examples on how this project has handled the sourcemaps problem throughout its history:

Here's Next.js justifying why sourcemaps are low priority despite every JS project on Earth needing them

#137

How to enable Sourcemaps?
Unfortunately, It's not supported for now. It's just low priority

Here's Next.js questioning why anyone would ever want sourcemaps on production, as if the coder asking the question is violating some secret agreement for daring to want a reliable stack trace for production bugs

#1903

Is it possible to generate/serve separate source map files in production?
But @Rowno exposing source maps into production is not a pretty good idea.

Here's a disobedient Next.js user baffled on how the project doesn't have reliable sourcemaps. Seems like he's trying to hurt people, too.

#2990

I have this problem too and I'm surprised more developers are not complaining about this issue. Is there a workaround for this?

And finally, my personal favorite, here's one where Next.js is, once again, justifying why it doesn't feel the need to warn users up front that sourcemaps are in a permanently EXPERIMENTAL state and cannot be relied upon. The reasoning? Oh, well, tone policing matters more than issuing clear and concise warnings about the project's feature set:

#2562

you're only trying to hurt people,

And before you continue to play the "Open Source" plausible deniability card, open source means being honest about what it is you are doing. I hope you approve of my PR to make people aware of Next.js's historical policy regarding sourcemaps before they decide to use it.

https://github.com/CodeOtter/next.js/pull/1

@timneutkens
Copy link
Member

Next 5.1 has better support for sourcemaps as I said before, just use next-sourcemaps, we worked on fixing those issues together with @ptomasroos.

Again please provide a reproducible example of what isn't working for your particular case so I can have a look into it.

@timneutkens
Copy link
Member

I'm expecting the original issue @remy was experiencing is fixed in Next.js 5+, going to close this. @remy if you're still experiencing it please provide a full example and I'll check it out 👍

@lock lock bot locked as resolved and limited conversation to collaborators May 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants