# @azimutlabs/config-next

> Next.js config extensions

Latest version **0.1.0** (published 2020-03-03) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @azimutlabs/config-next
pnpm add @azimutlabs/config-next
yarn add @azimutlabs/config-next
bun add @azimutlabs/config-next
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2020-03-03 |
| First published | 2020-02-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 17.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | AzimutLabs |
| Maintainers | azimutlabs-owner, olehan |
| Keywords | config, config-files, next.js, next, next.config, next.config.js, next-config, alabs |

## Links

- npm: https://www.npmjs.com/package/@azimutlabs/config-next
- Repository: https://github.com/azimutlabs/config
- Homepage: https://github.com/azimutlabs/config/tree/master/packages/config-next#readme
- Issues: https://github.com/azimutlabs/config/issues
- npm.io page: https://npm.io/package/@azimutlabs/config-next

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 0.1.0 (latest) — 2020-03-03
- 0.1.0-beta.2 — 2020-03-02
- 0.1.0-beta.1 — 2020-02-27

## README

# @azimutlabs/config-next
Next.js config extensions.

We assume that you already have `next` package installed.

+ [`withEslint`](withEslint.js) - adds `eslint`.
  - usage:
    ```javascript
    // next.config.js
    module.exports = withEslint({ // nextOptions
      eslintOptions: {} // options for eslint-loader
    });
    ```
  - required libs: `eslint`, `eslint-loader`, `eslint-friendly-formatter`.
  - download command: `npm i -D eslint-loader eslint-friendly-formatter`

+ [`withEnv`](withEnv.js) - adds env variables using [`next/config`](https://nextjs.org/docs/api-reference/next.config.js/runtime-configuration) runtime configurations.
  - usage:
    ```javascript
    // next.config.js
    module.exports = withEnv({ // nextOptions
      serverRuntimeConfig: {}, // optional variables for server config.
      publicRuntimeConfig: {}, // optional variables for both server and public config.
    });

    // .env
    // NEXT_PUBLIC_TEST=somevalue

    // pages/index.js
    import getConfig from 'next/config';
    const { NEXT_PUBLIC_TEST } = getConfig().publicRuntimeConfig;
    ```
  - to override env var prefixes you need to define variables:
    ```dotenv
    # .env
    # Prefix for serverRuntimeConfig
    SERVER_PREFIX=_
    # Prefix for publicRuntimeConfig
    PUBLIC_PREFIX=CLIENT_

    _PORT=3000

    CLIENT_API=api.github.com
    ```
  - recommended libs: [`dotenv-load`](https://www.npmjs.com/package/dotenv-load)

+ [`withLodash`](withLodash.js) - optimizes `lodash` dist size using `babel-plugin-lodash` and `lodash-webpack-plugin`.
  - usage:
    ```javascript
    // next.config.js
    module.exports = withLodash({ // nextOptions
      babelPluginLodashOptions: {}, // babel-plugin-lodash options.
      lodashWebpackPluginOptions: {}, // lodash-webpack-plugin options.
    });
    ```
  - required libs: `babel-plugin-lodash`, `lodash-webpack-plugin`.
  - download command: `npm i -D babel-plugin-lodash lodash-webpack-plugin`

+ [`withStylelint`](withStylelint.js) - adds [`stylelint-webpack-plugin`](https://github.com/webpack-contrib/stylelint-webpack-plugin) for [`stylelint`](https://stylelint.io/).
  - usage:
    ```javascript
    // next.config.js
    module.exports = withStylelint({ // nextOptions
      stylelintWebpackPluginOptions: {}, // stylelint-webpack-plugin options.
    });
    ```
  - required libs: `stylelint`, `stylelint-webpack-plugin`.
  - download command: `npm i -D stylelint stylelint-webpack-plugin`

+ [`withEmotion`](withEmotion.js) - adds [`@emotion/babel-preset-css-prop`](https://github.com/emotion-js/emotion/tree/master/packages/babel-preset-css-prop) for [`@emotion/core`](https://emotion.sh/docs/introduction).
  - ⚠️ NOTE: for some reason, `next.js` does not use `presets` that was injected into
    `next-babel-loader`'s options without creating `.babelrc` file.
    To make your project stay clean, you can configure your `babel` in `package.json`:
    ```json
    {
      "babel": {
        "presets": ["next/babel"]
      }
    }
    ```
  - usage:
    ```javascript
    // next.config.js
    module.exports = withEmotion({ // nextOptions
      babelPresetEmotionOptions: {}, // @emotion/babel-preset-css-prop options.
    });
    ```
  - required libs: `@emotion/core`, `@emotion/babel-preset-css-prop`.
  - download command: `npm i -D @emotion/core @emotion/babel-preset-css-prop`

+ [`withSass`](withSass.js) - adds `scss`, `scss-modules`, `sass-lint` (no `css`).
  - ❗️DEPRECATED❗ - we are planning to move into **CSS-in-JS** practise, so for now
    this extension is no longer maintained.️
  - usage:
    ```javascript
    // next.config.js
    module.exports = withSass({ // nextOptions
      sassLintOptions: {} // options for sass-lint-webpack plugin
    });
    ```
  - to enable `sass-lint` - add `sassLintOptions` field into `nextOptions` as shown in `usage` section.
  - required libs: `@zeit/next-sass`
  - required libs for sass-lint: `sass-lint`, `sass-lint-webpack`
  - download command: `npm i -D @zeit/next-sass`

#### Recommended usage
Combine by composing functions:
```javascript
module.exports = compose(
  withEslint,
  withSass,
  withEnv,
)({ // next config
  eslintConfig: {},
  sassLintConfig: {},
});
```

## [`LICENSE`](LICENSE)

---
_Source: https://npm.io/package/@azimutlabs/config-next · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
