All Projects → bem → next-global-css

bem / next-global-css

Licence: MIT license
A preset for nextjs allowing using 3d party libraries with global css

Programming Languages

javascript
184084 projects - #8 most used programming language
SCSS
7915 projects
CSS
56736 projects

Projects that are alternatives of or similar to next-global-css

next-qrcode
React hooks for generating QRCode for your next React apps.
Stars: ✭ 87 (+17.57%)
Mutual labels:  nextjs-plugin
next-mdx
next-mdx provides a set of helper functions for fetching and rendering local MDX files. It handles relational data, supports custom components, is TypeScript ready and really fast.
Stars: ✭ 176 (+137.84%)
Mutual labels:  nextjs-plugin
next-api-og-image
Easy way to generate open-graph images dynamically in HTML or React using Next.js API Routes. Suitable for serverless environment.
Stars: ✭ 179 (+141.89%)
Mutual labels:  nextjs-plugin
next-api-compose
🧬 Simple, dependency free, error aware and powerful utility to compose chain of multiple middleware into one Next.js API Route.
Stars: ✭ 22 (-70.27%)
Mutual labels:  nextjs-plugin
next-share
Social media share buttons for your next React apps.
Stars: ✭ 145 (+95.95%)
Mutual labels:  nextjs-plugin

next-global-css

npm node

A preset for nextjs allowing using 3d party libraries with global css.

⚠️ Be careful, this solution can be unstable due to nextjs updates.

🏗 Compatible

Current version works only for 10th version of nextjs or higher.

☄️ Install and usage

Installation:

npm i -PE next-global-css

Configure:

const { withGlobalCss } = require('next-global-css')

const withConfig = withGlobalCss()

module.exports = withConfig({
  /* Next.js config options here */
})

If your webpack configuration is already customized:

const { patchWebpackConfig } = require('next-global-css')

const nextConfig = {
  /* config options here */
  /* your already customized webpack option */
  webpack: (config, options) => {
    patchWebpackConfig(config, options)
  },
}

Allow css-modules from node-modules:

const { patchWebpackConfig } = require('next-global-css')
const webpackNodeExternals = require('webpack-node-externals')

module.exports = {
  reactStrictMode: true,
  webpack: (config, options) => {
    patchWebpackConfig(config, options)

    if (options.isServer) {
      config.externals = webpackNodeExternals({
        // Uses list to add this modules for server bundle and process.
        allowlist: [/design-system/],
      })
    }

    return config
  },
}

📜 License

Project is MIT licensed.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].