Skip to content

Commit 559a71f

Browse files
committed
fix: Type definitions are broken and won't make typescript compile correctly
1 parent c7ed401 commit 559a71f

File tree

3 files changed

+40
-1
lines changed

3 files changed

+40
-1
lines changed

Diff for: package-lock.json

+26
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"scripts": {
2929
"lint": "eslint 'src/**/*.ts'",
3030
"prebuild": "rimraf dist && rimraf docs",
31-
"build": "tsc --module commonjs -p ./tsconfig.build.json && rollup -c rollup.config.ts && npm run storybook:build && npm run build:clean",
31+
"build": "npm run storybook:build && tsc --module commonjs -p ./tsconfig.build.json && rollup -c rollup.config.ts && npm run build:clean",
3232
"build:clean": "ts-node tools/build-clean",
3333
"dev": "start-storybook -p 3000 -s ./public",
3434
"storybook:build": "build-storybook --quiet -c .storybook -s ./public -o docs",
@@ -132,7 +132,9 @@
132132
"ts-jest": "^23.10.2",
133133
"ts-loader": "^6.2.1",
134134
"ts-node": "^7.0.1",
135+
"ttypescript": "^1.5.10",
135136
"typescript": "^3.0.3",
137+
"typescript-transform-paths": "^1.1.14",
136138
"vue": "^2.6.11",
137139
"vue-loader": "^15.8.3",
138140
"vue-template-compiler": "^2.6.11"

Diff for: rollup.config.ts

+11
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import commonjs from 'rollup-plugin-commonjs'
44
import camelCase from 'lodash.camelcase'
55
import typescript from 'rollup-plugin-typescript2'
66
import json from 'rollup-plugin-json'
7+
import ttypescript from 'ttypescript'
78

89
const pkg = require('./package.json')
910

@@ -47,6 +48,16 @@ export default {
4748
json(),
4849
// Compile TypeScript files
4950
typescript({
51+
// Fix typescript definition paths
52+
typescript: ttypescript,
53+
tsconfigDefaults: {
54+
compilerOptions: {
55+
plugins: [
56+
{ transform: 'typescript-transform-paths' },
57+
{ transform: 'typescript-transform-paths', afterDeclarations: true }
58+
]
59+
}
60+
},
5061
useTsconfigDeclarationDir: true
5162
}),
5263
// Allow bundling cjs modules (unlike webpack, rollup doesn't understand cjs)

0 commit comments

Comments
 (0)