I have two app projects which use rem for responsive design, but they have different rem unit, one is for vw, the other is for vw. They all have an dependency package that contains business component and style. So I want to bundle the business component library with rollup and rollup-plugin-postcss. So I need componets and style files with different rem unit.
Is there a way to extract two kinds of style files with different rem unit like below?
{
input: 'src/index.js',
output: [
{
file: pkg.main,
format: 'cjs',
sourcemap: true
},
{
file: pkg.module,
format: 'es',
sourcemap: true
}
],
plugins: [
postcss(postcssConfig1),
postcss(postcssConfig2),
]
}
But this pattern will throw error that there are invalid input for the second postcss plugin. So I have to create two rollup config to bundle two times, every time have different postcss plugin config. the disadvantages is it will bundle two times.
Are there some other better solutions for the case?