@freshcells/next-transpile-vendor-styles
v1.1.2
Published
next-transpile-vendor-styles ---------------------
Downloads
920
Keywords
Readme
next-transpile-vendor-styles
Adds support for vendor style transpilation for next.js. Based on https://github.com/martpie/next-transpile-modules.
Install
yarn add @freshcells/next-transpile-vendor-styles
Usage
In your nextjs.config.mjs
import { PHASE_PRODUCTION_SERVER } from 'next/constants.js'
export default async (phase) => {
if (phase === PHASE_PRODUCTION_SERVER) {
return { /* your nextjs config */ }
}
// Lazy load modules we require for the compilation only.
// This way we can later omit the package for production
const transpileVendorStyles = await import('@freshcells/next-transpile-vendor-styles')
return withTransform = transpileVendorStyles.default([
'@your-namespace/module-1',
'@your-namespace/module-2'
])
return withTransform({
/* your nextjs config */
})
}