next.js: Failed to load pages importing css

Bug report

Describe the bug

I’m working on next.js 7.0.0 and next-css 1.0.0. I created following two pages.

pages/index.tsx

import Link from 'next/link';
export default () => <Link href="/css"><a>Go</a></Link>;

pages/css.tsx

import "../style.css";
export default () => <div className="example">styled text</div>;

When I click the link in the index page, css page is not displayed. I removed the import statement from css page, it works fine.

To Reproduce

  1. Clone git@github.com:hikoma/next-css-bug.git
  2. yarn && yarn dev
  3. Click a “With css import” link

Expected behavior

Pages importing css should be loaded.

System information

  • OS: Ubuntu 18.04
  • Version of Next.js: 7.0.0
  • Version of next-css: 1.0.0

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 20
  • Comments: 16 (6 by maintainers)

Most upvoted comments

I still have the same problem

any updates?

@needcaffeine Not working yet.

@zlwaterfield @hikoma I find a way 👍

import one of less or css file in _app.js then you can import other style file in other pages

//_app.js

import '../scss/index.less'

//index.less

body{}

this problem is fixed, but I dont know this is a bug?