Skip to content

Latest commit

 

History

History

nextjs-plugin

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

@stylexjs/nextjs-plugin

Documentation Website

https://stylexjs.com

Installation

Install the package by using:

npm install --save-dev @stylexjs/nextjs-plugin

or with yarn:

yarn add --dev @stylexjs/nextjs-plugin

⚠️ @/ alias is unsupported at the moment.

Add the following to your .babelrc.js

module.exports = {
  presets: ['next/babel'],
  plugins: [
    [
      '@stylexjs/babel-plugin',
      {
        dev: process.env.NODE_ENV === 'development',
        runtimeInjection: false,
        genConditionalClasses: true,
        unstable_moduleResolution: {
          type: 'commonJS',
          rootDir: __dirname,
        },
      },
    ],
  ],
};

Add the following to your next.config.js

const stylexPlugin = require('@stylexjs/nextjs-plugin');

module.exports = stylexPlugin({
  rootDir: __dirname,
})({});