Closed Barbapapazes closed 1 month ago
I expect to have
├── vite.cjs
├── vite.d.cts
├── vite.d.mts
├── vite.d.ts
├── vite.mjs
├── webpack.cjs
├── webpack.d.cts
├── webpack.d.mts
├── webpack.d.ts
└── webpack.mjs
but I only got
├── vite.d.ts
├── vite.mjs
├── webpack.d.ts
└── webpack.mjs
Here was my work around for now, just a snippet I use in most the configs:
function dualOutput(
config: Omit<MkdistBuildEntry, "builder" | "format">
): BuildEntry[] {
return [
{
builder: "mkdist",
format: "esm",
...config,
pattern: "**/!(*.stories).{js,jsx,ts,tsx}",
},
{
builder: "mkdist",
format: "cjs",
...config,
pattern: "**/!(*.stories).{js,jsx,ts,tsx}",
},
];
}
export default defineBuildConfig({
entries: [
"./src/index",
...dualOutput({
input: "./src/components/Bits/",
outDir: "./dist/bits",
}),
Here was my work around for now, just a snippet I use in most the configs:
function dualOutput( config: Omit<MkdistBuildEntry, "builder" | "format"> ): BuildEntry[] { return [ { builder: "mkdist", format: "esm", ...config, pattern: "**/!(*.stories).{js,jsx,ts,tsx}", }, { builder: "mkdist", format: "cjs", ...config, pattern: "**/!(*.stories).{js,jsx,ts,tsx}", }, ]; }
export default defineBuildConfig({ entries: [ "./src/index", ...dualOutput({ input: "./src/components/Bits/", outDir: "./dist/bits", }),
Yeah, I'm also using this way but, since there is a way to generate both with the rollup preset, I was hoping to do the same way for mkdist!
Moving docs to https://github.com/unjs/unbuild/issues/398
Hello,
I was experimenting with unbuild and I encounter an issue.
Is it possible (if recommanded) to build to esm and cjs at the same time using
mkdist
like with rollup?