question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using with Next.js

See original GitHub issue

I’ve attempted to use this project in a fresh Next.js and the various examples that they provide.

However, it is challenging to understand how to properly alias the ~_variables.sass file that this project looks for by default.

Next does not support webpack aliases, and the discussion around that suggests creating a babel alias.

On top of that, setting up Next to be able to handle SASS generation seemed to be quite challenging and I couldn’t find any examples.

Does anyone have an example of a Next.js configuration working for this? If not, I’ll put a question on Stack Overflow.

For reference, I’ve made a clean installation of Next.js and react-bulma-components where you can see that it is unable to locate the ~_variables.sass file. As an experiment, if I create that file in the node_modules/react-bulma-components directory as a test, it does find it, but then fails on SASS compilation.

Here’s a minimal repo to see the problem: https://github.com/stefl/react-bulma-components-next

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

5reactions
coudscommented, Dec 23, 2018

Hi @stefl

If you are still interested. I just released a new version (Still on pre-release) that fix allow this library to work properly with Next.js (commit c77aaf6964d48c2f3cdf0ee31c503d4648f57efd)

Check it out in here

You need to update your sassLoaderOptions to include the path to your _variables.sass file and tell Next to that this library its already transpiled

const withSass = require('@zeit/next-sass')
const withTM = require('next-plugin-transpile-modules');

module.exports = withTM(withSass({
    transpileModules: ['react-bulma-components'],
    sassLoaderOptions: {
        includePaths: ["./src"]
    },
}))

Hope this help, and sorry for the long wait

0reactions
alexander-sakalcommented, May 14, 2020

Hi @couds I have the same issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting Started | Next.js
If you're new to Next.js, we recommend starting with the learn course. The interactive course with quizzes will guide you through everything you...
Read more >
Create a Next.js App | Learn Next.js
Next.js: The React Framework · An intuitive page-based routing system (with support for dynamic routes) · Pre-rendering, both static generation (SSG) and server- ......
Read more >
Setup - Create a Next.js App
You'll be using your own text editor and terminal app for this tutorial. ... the directory you'd like to create the app in,...
Read more >
Basic Features: Pages - Next.js
In Next.js, a page is a React Component exported from a .js , .jsx , .ts , or .tsx file in the pages...
Read more >
What is Next.js?
Next.js is a React framework that gives you building blocks to create web applications. By framework, we mean Next.js handles the tooling and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found