-
Notifications
You must be signed in to change notification settings - Fork 319
Not finding _next/static/ #77
Comments
Using next export? try upgrading to |
Hi @timneutkens, I am not using next export, I am using next-css exactly as described in the README.md |
I'm also unable to make
const withTypescript = require("@zeit/next-typescript");
const withCss = require("@zeit/next-css");
module.exports = withTypescript(withCss());
import Document, { Head, Main, NextScript } from "next/document";
import { ServerStyleSheet } from "styled-components";
import styles from "../styles/index.css";
export default class MyDocument extends Document {
public static getInitialProps({ renderPage }) {
const sheet = new ServerStyleSheet();
const page = renderPage((App) => (props) =>
sheet.collectStyles(<App {...props} />),
);
const styleTags = sheet.getStyleElement();
return { ...page, styleTags };
}
public render() {
return (
<html>
<Head>
<title>Test Page</title>
<link rel="stylesheet" href="/_next/static/style.css" />
{this.props.styleTags}
</Head>
<body>
<Main />
<NextScript />
</body>
</html>
);
}
} Requests to
I'm using a custom ts server to enable // ...
app.prepare().then(() => {
const server = express();
// enable middleware for i18next
server.use(i18nextMiddleware.handle(i18nInstance));
// serve locales for client
server.use("/locales", express.static(join(__dirname, "../locales")));
// missing keys
server.post(
"/locales/add/:lng/:ns",
i18nextMiddleware.missingKeyHandler(i18nInstance),
);
// use next.js
server.get("*", (req, res) => {
// const parsedUrl = parse(req.url, true);
(req as any).graphqlUri = env.GRAPHQL_URI;
// req.i18n = i18nInstance;
handle(req, res);
});
server.listen(env.PORT, (err) => {
if (err) {
throw err;
}
console.log(`> Ready on port ${env.PORT}`);
});
// ... What is also interesting is that if I replace
Moving @timneutkens what can be wrong in this setup? |
UPD: I finaly made styles partially working in my TypeScript + CSS project. The trick was to use I moved styles to import { compose } from "recompose";
import "../pageEvents";
import withData from "./withData";
import withI18next from "./withI18next";
// tslint:disable:no-var-requires
require("normalize.css");
require("../../styles/base.css");
require("../../styles/nprogress.css");
export default (i18nextNamespaces = ["common"]) =>
compose(withData, withI18next(i18nextNamespaces)); Unfortunately, I haven't been able to replace three requires with @import "normalize.css";
@import "./base.css";
@import "./nprogress.css"; When I do so I get:
Any thoughts why css |
Me again 😅 ! Here is what worked in @import "../node_modules/normalize.css/normalize.css";
@import "./base.css";
@import "./nprogress.css"; 🎉 To summarize, here are the remaining issues in my
|
Have the same issue, using 5.1.0, 404 on /_next/static/style.css. Also followed the instructions |
Hi, I am using next-css with next-typescript, but when I import inside my _document.tsx the CSS files, which are all inside _next/static/, the styles are not applied to the pages of the app.
My project/pages/_document.tsx tag has:
<link rel="stylesheet" href="../_next/static/header.css" />
<link rel="stylesheet" href="../_next/static/index.css" />
My next.config.js is:
`
const withTypescript = require('@zeit/next-typescript');
const withCSS = require('@zeit/next-css');
module.exports = withCSS(withTypescript({
webpack(config, options) {
return config
},
typescriptLoaderOptions: {
transpileOnly: false
}
}));
`
My _next/ and pages/ folders are ate the same leve in the Project's root folder.
The styles are not being applied anywhere and I can't figure out why.
The text was updated successfully, but these errors were encountered: