next export builds, but errors in client…
See original GitHub issue- 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) |
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:5 (3 by maintainers)
Top Results From Across the Web
next export builds, but errors in client… · Issue #2562 - GitHub
Ran next export and when I serve locally (and online) there's a client side JavaScript error that breaks all the client side logic....
Read more >Next.js build error: Export encountered errors on following paths
I found onething, when i assigned a static value and it was built, but I never wanted it. const routine1 = {id :1,...
Read more >Advanced Features: Static HTML Export | Next.js
Export your Next.js app to static HTML, and run it standalone without the need of a Node.js server.
Read more >Understanding static HTML export in Next.js - LogRocket Blog
Learn why you should use HTML static exporting from a Next.js application, HTML static export use cases, and how you can do it...
Read more >Static HTML Export with i18n compatibility in Next.js
BUT, you may have heard about this: ... This happens if you're using the internationalized routing feature and are trying to generate a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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
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
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
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
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
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.