@freshcells/next-transpile-vendor-styles

1.1.2 • Public • Published

next-transpile-vendor-styles

semantic-release GitHub license badge npm

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 */
    })
}

/@freshcells/next-transpile-vendor-styles/

    Package Sidebar

    Install

    npm i @freshcells/next-transpile-vendor-styles

    Weekly Downloads

    165

    Version

    1.1.2

    License

    none

    Unpacked Size

    23.5 kB

    Total Files

    5

    Last publish

    Collaborators

    • marvinstrenger
    • ntsvetkova.fcse
    • davidheidrich