Open xypnox opened 1 month ago
This is a packaging issue, as your Astro config is explicitly defined not to include node_modules
, which brings us to your Rollup config where you only defined [solidStyled]
which shouldn't work as it is supposed to be solidStyled(options)
.
Changing the plugin field for rollup:
import withSolid from "rollup-preset-solid";
import solidStyled from 'rollup-plugin-solid-styled';
export default withSolid({
targets: ["esm", "cjs"],
input: 'src/index.tsx',
plugins: [solidStyled()]
// or plugins: [solidStyled({})]
});
Throws the error: solidStyled__default.default is not a function
1 % pnpm build
> xip-ui@0.1.0 build /home/xypnox/Projects/x/xip/packages/xip-ui
> rollup -c
[!] TypeError: solidStyled__default.default is not a function
TypeError: solidStyled__default.default is not a function
at Object.<anonymous> (/home/xypnox/Projects/x/xip/packages/xip-ui/rollup.config.js:16:44)
at Module._compile (node:internal/modules/cjs/loader:1254:14)
at Object.require.extensions.<computed> [as .js] (/home/xypnox/Projects/x/xip/node_modules/.pnpm/rollup@2.79.1/node_modules/rollup/dist/shared/loadConfigFile.js:621:20)
at Module.load (node:internal/modules/cjs/loader:1117:32)
at Function.Module._load (node:internal/modules/cjs/loader:958:12)
at Module.require (node:internal/modules/cjs/loader:1141:19)
at require (node:internal/modules/cjs/helpers:110:18)
at loadConfigFromBundledFile (/home/xypnox/Projects/x/xip/node_modules/.pnpm/rollup@2.79.1/node_modules/rollup/dist/shared/loadConfigFile.js:631:42)
at getDefaultFromTranspiledConfigFile (/home/xypnox/Projects/x/xip/node_modules/.pnpm/rollup@2.79.1/node_modules/rollup/dist/shared/loadConfigFile.js:613:12)
at loadConfigFile (/home/xypnox/Projects/x/xip/node_modules/.pnpm/rollup@2.79.1/node_modules/rollup/dist/shared/loadConfigFile.js:572:11)
ELIFECYCLE Command failed with exit code 1.
I am also using the solid rollup preset.
classic. Can you try unplugin-solid-styled
instead?
Using a solid-styled component inside astro locally works fine ex:
https://github.com/xypnox/xip/blob/5a7d8731d9b9bde7d4d688870551d8ec23628226/packages/xip-warehouse/src/components/pureStyled.tsx#L1-L12
However, using from a package: https://github.com/xypnox/xip/blob/5a7d8731d9b9bde7d4d688870551d8ec23628226/packages/xip-warehouse/src/components/ui.tsx#L15-L22
Results in the error:
Unexpected use of css. Make sure that solid-styled's plugin is setup correctly.
Reference