umbopepato / rollup-plugin-postcss-lit

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

default import error #51

Closed kinghat closed 1 year ago

kinghat commented 2 years ago

i think the issue is related to: https://github.com/umbopepato/rollup-plugin-postcss-lit/issues/45#issuecomment-885439744 but im not sure what i need to change in the config:

Module '"/home/kinghat/code/tabbed-card/node_modules/.pnpm/rollup-plugin-postcss-lit@2.0.0/node_modules/rollup-plugin-postcss-lit/dist/index"' can only be default-imported using the 'allowSyntheticDefaultImports' flagts(1259) index.d.ts(21, 1): This module is declared with using 'export =', and can only be used with a default import when using the 'allowSyntheticDefaultImports' flag.

my configs:

// tsconfig.json

{
  "compilerOptions": {
...
    "allowSyntheticDefaultImports": true,
...
}
// vite.config.ts

import { defineConfig } from "vite";
import postcssLit from "rollup-plugin-postcss-lit";

export default defineConfig({
  plugins: [postcssLit()],
  build: {
    lib: {
      entry: "src/tabbed-card.ts",
      formats: ["es"],
    },
    rollupOptions: {
      external: /^lit/,
    },
  },
});

is import * as postcssLit from "rollup-plugin-postcss-lit"; an acceptable workaround?

umbopepato commented 1 year ago

Hey @kinghat, are you still experiencing this issue? I tried with different TS import options but I cannot reproduce it (at least with recent versions of TS and Vite)

kinghat commented 1 year ago

Hey @kinghat, are you still experiencing this issue? I tried with different TS import options but I cannot reproduce it (at least with recent versions of TS and Vite)

im not sure if this is still an issue but i switched away from using the plugin. will close.