Common Next.js configuration and plugins for Lightspeed apps
npm install @lightspeed/config-next@lightspeed/config-next
Next.js configuration and plugins in a convenient package.
- Please ensure you are using next@9 or higher
- ✨ Enables TypeScript in your Next.js app
- 🔥 Configures HMR polling to run dev mode in Docker
- ➡ Absolute path resolving for root src:
``js
// From anywhere in your app, this will resolve to
import { MyComponent } from 'src/components/MyComponent';
``
1. Install the dependency in your webapp.
`sh`
yarn add next @lightspeed/config-next
2. Consume the Next.js plugin.
`js`
// next.config.js
const withLightspeed = require('@lightspeed/config-next');
module.exports = withLightspeed();
3. Consume the Babel preset.
`js`
// babel.config.js
module.exports = {
presets: ['@lightspeed/config-next/babel-preset-next'],
};
3. Optionally, extend the configuration as you see fit.
`js``
// babel.config.js
module.exports = {
presets: [
[
'@lightspeed/config-next/babel-preset-next',
{
'next-babel': {
'preset-env': {
targets: {
browsers: ['not ie'],
},
},
},
},
],
],
};