I have the components getting imported from my component library internal to my company.
The component library uses rollup:
rollup.config.mjs
import commonjs from '@rollup/plugin-commonjs';
import json from '@rollup/plugin-json';
import resolve from '@rollup/plugin-node-resolve';
import typescript from '@rollup/plugin-typescript';
import dts from 'rollup-plugin-dts';
import peerDepsExternalPlugin from 'rollup-plugin-peer-deps-external';
import postcss from 'rollup-plugin-postcss';
import { babel } from '@rollup/plugin-babel';
import { createRequire } from 'node:module';
const requireFile = createRequire(import.meta.url);
const packageJson = requireFile('./package.json');
export default [
{
input: 'src/index.ts',
output: [
{
file: packageJson.main,
format: 'cjs',
sourcemap: true,
},
{
file: packageJson.module,
format: 'esm',
sourcemap: true,
},
],
plugins: [
babel({ babelHelpers: 'bundled' }),
resolve(),
commonjs(),
typescript({
exclude: ['**/tests/', '**/stories/'],
}),
json(),
postcss({
extensions: ['.css'],
}),
peerDepsExternalPlugin(),
],
},
{
input: 'dist/index.d.ts',
output: [{ file: 'dist/index.d.ts', format: 'es' }],
plugins: [dts()],
// not sure we want this (external) option here
external: [/\.css$/]
},
];
Then I build it.
And from the nextjs application I have it in the package json. use yarn link
to link the two repos (and I know yarn link is working).
But none of the styles get passed through to my next js application using my component library.
I've tried changing my next.config.js
to this and it did nothing.
/** @type {import('next').NextConfig} */
module.exports = {
reactStrictMode: false,
compiler: {
styledComponents: {
// Enabled by default.
cssProp: true,
},
},
};
This is my .babelrc
{
"plugins": ["babel-plugin-styled-components"]
}
Any help here would be incredible.