Skip to content

Instantly share code, notes, and snippets.

@clukhei
Last active July 29, 2022 07:35
Show Gist options
  • Save clukhei/c26676f7b9534847b5e8c3735fd5d67a to your computer and use it in GitHub Desktop.
Save clukhei/c26676f7b9534847b5e8c3735fd5d67a to your computer and use it in GitHub Desktop.
subpath imports rollup part 1
const packageJson = require("./package.json");
export default [
{
input: ["src/index.ts"],
output: [
{
file: packageJson.module,
format: "esm",
sourcemap: true,
exports: "named",
},
{
file: packageJson.main,
format: "cjs",
sourcemap: true,
exports: "named",
},
],
plugins,
external: ["react", "react-dom"],
},
...folderBuilds,
];
const folderBuilds = getFolders('./src').map((folder) => {
return {
input: `src/${folder}/index.ts`,
output: {
file: `dist/${folder}/index.js`,
sourcemap: true,
exports: 'named',
format: 'esm',
},
plugins: subfolderPlugins(folder),
external: ['react', 'react-dom'],
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment