Open viniciusflv opened 1 year ago
Same issue, looking to ignore/filter linaria generated css files from postcss to see if that resolves?
Any updates on that topic? Just wanted to do the same and didn't work out as expected 😅 codesandbox
Did some diving in the issues and apparently its easy to disable one of the internal plugins by creating a local plugin:
import { defineConfig, Options } from "tsup";
import linaria from "@linaria/esbuild"
type Plugin = NonNullable< Options["plugins"]>[number]
const disablePlugin = (name: string):Plugin => ({
name: `disable-plugin-${name}`,
esbuildOptions: (options) => {
const plugin = options.plugins?.find(({name}) => name === "postcss");
if (plugin) {
plugin.setup = () => Promise.resolve();
}
},
})
export default defineConfig({
...
esbuildPlugins: [
linaria({
displayName: true,
sourceMap: true
}),
],
plugins: [disablePlugin("postcss"), disablePlugin("svelte")],
})
At least that's a solution for now. Would be great if there would be options to exclude internal plugins that can be made optional or if they weren't being included by default, but could just added by the user. :)
Description
Recently I've been testing with linariacss, and I think is a great fit for Design Systems using tsup to compile the lib.
But even tho has esbuild support, it hasn't worked with tsup, throwing the following error:
Looking the source code, I had noticed that the postcss is one of the default plugins, so I tried removing it and worked.
Steps to reproduce
Install the dependencies
Create an entry file
src/index.js
export const Linaria = () => ( <div className={css
color: red;
}const prod = process.env.NODE_ENV === "production";
export default defineConfig({ entry: ["src/index.ts"], platform: "node", format: ["cjs", "esm"], splitting: false, sourcemap: true, clean: true, dts: true, esbuildPlugins: [ linaria({ sourceMap: prod, }), ], });