rollup-plugin-postcss icon indicating copy to clipboard operation
rollup-plugin-postcss copied to clipboard

Code Splitting, multiple entry points

Open r4fx opened this issue 7 years ago • 4 comments

Hi!

does rollup-plugin-postcss works with rollups experimentalCodeSplitting option ? I need to use multiple inputs what seems to work in general for .js content, but it looks that postcss does not extract any css files when experimentalCodeSplitting is set to true

r4fx avatar Jun 27 '18 09:06 r4fx

I'm having the same problem.

This works

import postcss from 'rollup-plugin-postcss';

export default {
  input: 'components/header/header.js',
  output: {
    file: 'dist/index.js',
    sourceMap: true,
    format: 'cjs',
  },
  plugins: [
    postcss({
      extract: true,
      plugins: [],
      sourceMap: true,
    })
  ]
};

but this does not

import postcss from 'rollup-plugin-postcss';

export default {
  input: ['components/button/button.js', 'components/header/header.js'],
  experimentalCodeSplitting: true,
  output: {
    dir: 'dist/',
    sourceMap: true,
    format: 'cjs',
  },
  plugins: [
    postcss({
      extract: true,
      plugins: [],
      sourceMap: true,
    })
  ]
};

I get [!] (postcss plugin) TypeError: Path must be a string. Received undefined

alisonailea avatar Aug 28 '18 17:08 alisonailea

You must set extract to the path where you want the css to be extracted, but sadly it will not extract one css file per bundle, that would be pretty cool!

isidrok avatar Nov 05 '18 19:11 isidrok

This seems to not work when sourceMap: true. It looks like PR #136 might have fixed it, but I haven't run the most recent (unreleased) code. @egoist, any idea when that might get released?

jkjustjoshing avatar Jan 18 '19 15:01 jkjustjoshing

Seems to work fine for me with the stable code splitting, however, you indeed only get a single SCSS bundle.

fgblomqvist avatar Sep 30 '21 14:09 fgblomqvist