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

Stylesheet not included in next export build #3712

Closed
1 task done
stephenmathieson opened this issue Feb 6, 2018 · 5 comments
Closed
1 task done

Stylesheet not included in next export build #3712

stephenmathieson opened this issue Feb 6, 2018 · 5 comments

Comments

@stephenmathieson
Copy link
Contributor

I've just started moving an app over to Next v5. I'm doing this in small chunks, and have just finished a page. In order to verify it in production-mode, I ran the build (NODE_ENV=production next build && NODE_ENV=production next export). The styles.css file is correctly build/saved to ./.next/static/styles.css, but it is not included in the exported build (./out/**).

This results in 404s when requesting the stylesheet.

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

Expected Behavior

The stylesheet should be included in the exported build.

Current Behavior

The stylesheet is not included in the exported build.

Steps to Reproduce (for bugs)

  1. Add @zeit/next-css to your next.config.js
  2. Import a .css file
  3. Run next build
  4. Run next export
  5. Run serve ./out
  6. Run curl http://localhost:3000/_next/static/style.css to see the 404

Context

This has prevented me from migrating to Next v5.

Your Environment

Tech Version
next 5
node 8
OS High Sierra
browser *
etc
@gihrig
Copy link
Contributor

gihrig commented Feb 8, 2018

I ran into the same issue. Until this get's a proper fix. I added this to my package.json scripts

"export": "next build && next export && cp -R ./.next/static ./out/_next/static/"

@arunoda
Copy link
Contributor

arunoda commented Feb 8, 2018

We actually fixed this.
Check this canary version: https://github.com/zeit/next.js/releases/tag/5.0.1-canary.1

We'll ship a stable release soon.

@arunoda arunoda closed this as completed Feb 8, 2018
@Ehesp
Copy link
Contributor

Ehesp commented Feb 14, 2018

Can confirm this is fixed in 5.0.1-canary.1!

@quickhand
Copy link

quickhand commented Feb 20, 2018

Just tried the 5.0.1-canary.6 -- the stylesheet is now linked properly when assetPrefix is not defined in next.config.js, but fails when it is defined. Script files are included as <my prefix>/_next/<...>/index.js, while the css file is included as /_next/static/style.css with no prefix.

@markolofsen
Copy link

markolofsen commented Jun 30, 2018

The same problem!!! Not included with build, but working in dev.

_document
<link rel="stylesheet" href="/_next/static/style.css" />

package
"next": "^6.0.4-canary",

@lock lock bot locked as resolved and limited conversation to collaborators Jul 1, 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

6 participants