umbopepato / rollup-plugin-postcss-lit

Rollup plugin to load PostCSSed stylesheets in LitElement components
MIT License
34 stars 6 forks source link

Can't use it with `@web/dev-server` #45

Closed abdonrd closed 3 years ago

abdonrd commented 3 years ago

I just tried to use it with the @web/dev-server, but I get this error:

Error: fromRollup should be called with a rollup plugin function. Received: [object Object]

The config:

// ...
import { fromRollup } from '@web/dev-server-rollup';
import rollupPostcss from 'rollup-plugin-postcss';
import rollupPostcssLit from 'rollup-plugin-postcss-lit';

const postcss = fromRollup(rollupPostcss);
const postcssLit = fromRollup(rollupPostcssLit);

export default {
  // ...
  mimeTypes: {
    '**/*.scss': 'js',
  },
  plugins: [
    // ...
    postcss({
      inject: false,
    }),
    postcssLit({
      importPackage: 'lit',
    }),
  ],
};
abdonrd commented 3 years ago

Oh! It works change it from:

const postcssLit = fromRollup(rollupPostcssLit);

To:

const postcssLit = fromRollup(rollupPostcssLit.default);
umbopepato commented 3 years ago

Hey @abdonrd, thanks for reporting this! I've switched from export default to export = so that .default is not required anymore in node esm, the fix will be available in v1.1.1 soon 🙂