Skip to content

Commit

Permalink
fix: correct export assignments in declaration files
Browse files Browse the repository at this point in the history
  • Loading branch information
recursive-beast committed Mar 13, 2021
1 parent 9282b0c commit 8fed136
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 25 deletions.
52 changes: 29 additions & 23 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,42 @@ import ts from "@wessberg/rollup-plugin-ts";
import transformDefaultExport from "ts-transform-default-export";
import pkg from "./package.json";

export default {
input: "src/index.ts",
output: [
{
const external = [
...Object.keys(pkg.dependencies),
// ...Object.keys(pkg.peerDependencies),
...builtinModules,
];

export default [
{
input: "src/index.ts",
output: {
file: pkg.main,
format: "cjs",
exports: "default",
sourcemap: true,
},
{
external,
plugins: [
nodeResolve(),
ts({
transformers: ({ program }) => ({
afterDeclarations: transformDefaultExport(program),
}),
}),
],
},
{
input: "src/index.ts",
output: {
file: pkg.module,
format: "es",
sourcemap: true,
},
],
external: [
...Object.keys(pkg.dependencies),
// ...Object.keys(pkg.peerDependencies),
...builtinModules,
],
plugins: [
nodeResolve(),
ts({
exclude: "node_modules/**/*",
transformers: ({ program }) => ({
afterDeclarations: transformDefaultExport(program, { keepOriginalExport: true }),
}),
}),
],
watch: {
exclude: /node_modules/,
external,
plugins: [
nodeResolve(),
ts(),
],
},
};
];
3 changes: 1 addition & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"strict": true,
"esModuleInterop": true,
"moduleResolution": "node",
"sourceMap": true,
"target": "ES5"
"sourceMap": true
},
"include": [
"src/*"
Expand Down

0 comments on commit 8fed136

Please sign in to comment.