1.0.0 • Published 6 years ago

@blunck/next-alias v1.0.0

Weekly downloads
74
License
MIT
Repository
github
Last release
6 years ago

Next.js + Webpack Aliases

Use Webpack Aliases in your Next.js project

Installation

npm install --save @blunck/next-alias

Usage

Create a next.config.js in your project

// next.config.js
const withAlias = require('@blunck/next-alias')({
    '@components': __dirname + '/components'
})
module.exports = withAlias()

You can now use aliases in your imports

import foo from '@components/Blog'

export default () => <Blog />

Configuring Next.js

Optionally you can add your custom Next.js configuration as parameter

// next.config.js
const withAlias = require('@blunck/next-alias')()
module.exports = withAlias({
    webpack(config, options) {
        return config
    }
})