Next-plugins: Cannot load css from node_modules, no error message

Created on 17 Dec 2019  路  4Comments  路  Source: vercel/next-plugins

When I add import react-day-picker/lib/style.css, the page that this component is on will not load during client-side routing and there is no error or anything else to indicate what is wrong. It does load if you visit /day directly. Also, removing the import allows the route to load.

Reproduced in this repo:
https://github.com/tim-phillips/nextjs-css

This solution does not work: https://github.com/zeit/next-plugins/issues/70#issuecomment-474722343

Most helpful comment

Yeah, I'm also facing this issue.

When switching to a page that imports a css file, the script of that page is successfully loaded by the page-loader of client, however, the css file is not loaded. Then the router doesn't change and no any information is prompted.

I've tried to figure it out in a tricky way by using next/dynamic to import such a component like below:
```jsx harmony
// my-page.js
import dynamic from 'next/dynamic'

const MyComponent = dynamic(() => import('path/to/ComponentWithCss'), { ssr: false })

export default () => (




)
```

Hope this issue could be fixed.

All 4 comments

Yeah, I'm also facing this issue.

When switching to a page that imports a css file, the script of that page is successfully loaded by the page-loader of client, however, the css file is not loaded. Then the router doesn't change and no any information is prompted.

I've tried to figure it out in a tricky way by using next/dynamic to import such a component like below:
```jsx harmony
// my-page.js
import dynamic from 'next/dynamic'

const MyComponent = dynamic(() => import('path/to/ComponentWithCss'), { ssr: false })

export default () => (




)
```

Hope this issue could be fixed.

Same error for me trying to import Quill CSS from node_modules:

import 'quill/dist/quill.core.css';

I fixed a similar problem when export components from static route folders.

Hi, thanks for creating an issue. We currently recommend using https://nextjs.org/docs/basic-features/built-in-css-support as the plugins have been deprecated in favor of the built-in support.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mitaxe picture mitaxe  路  4Comments

suppayami picture suppayami  路  3Comments

harrysolovay picture harrysolovay  路  4Comments

Jungwoo-An picture Jungwoo-An  路  4Comments

pencilcheck picture pencilcheck  路  4Comments