Skip to content

Commit c487260

Browse files
author
Elias Mulhall
committed
Configure rollup and typescript to fix declaration file issues
1 parent 2abab21 commit c487260

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
"version": "1.0.1",
44
"description": "runtime type checking and validation of untyped JSON data",
55
"keywords": ["TypeScript", "JSON"],
6-
"main": "dist/json-type-validation.umd.js",
7-
"module": "dist/json-type-validation.es5.js",
8-
"typings": "dist/types/json-type-validation.d.ts",
6+
"main": "dist/index.umd.js",
7+
"module": "dist/index.es5.js",
8+
"typings": "dist/types/index.d.ts",
99
"files": ["dist"],
1010
"author": "Elias Mulhall <elias@mojotech.com>",
1111
"repository": {

rollup.config.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,13 @@
11
import resolve from 'rollup-plugin-node-resolve';
22
import commonjs from 'rollup-plugin-commonjs';
33
import sourceMaps from 'rollup-plugin-sourcemaps';
4-
import camelCase from 'lodash.camelcase';
54
import typescript from 'rollup-plugin-typescript2';
65

76
const pkg = require('./package.json');
87

9-
const libraryName = 'json-type-validation';
10-
118
export default {
129
input: `src/index.ts`,
13-
output: [
14-
{file: pkg.main, name: camelCase(libraryName), format: 'umd'},
15-
{file: pkg.module, format: 'es'}
16-
],
10+
output: [{file: pkg.main, name: 'index', format: 'umd'}, {file: pkg.module, format: 'es'}],
1711
sourcemap: true,
1812
// Indicate here external modules you don't wanna include in your bundle (i.e.: 'lodash')
1913
external: [],
@@ -22,7 +16,9 @@ export default {
2216
},
2317
plugins: [
2418
// Compile TypeScript files
25-
typescript(),
19+
typescript({
20+
useTsconfigDeclarationDir: true
21+
}),
2622
// Allow bundling cjs modules (unlike webpack, rollup doesn't understand cjs)
2723
commonjs(),
2824
// Allow node_modules resolution, so you can use 'external' to control

0 commit comments

Comments
 (0)