Skip to content

Commit a39f68f

Browse files
fix: resolveId importer is optional (#3)
1 parent 2614cf0 commit a39f68f

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
import { join } from 'path';
22
import { CompilerOptions, findConfigFile, nodeModuleNameResolver, sys } from 'typescript';
3+
import { Plugin } from 'rollup';
34

45
export const typescriptPaths = ({
56
tsConfigPath = findConfigFile('./', sys.fileExists),
67
absolute = true,
78
transform,
8-
}: Options = {}) => {
9+
}: Options = {}): Plugin => {
910
const { compilerOptions, outDir } = getTsConfig(tsConfigPath);
1011

1112
return {
1213
name: 'resolve-typescript-paths',
13-
resolveId: (importee: string, importer: string) => {
14-
if (importee.startsWith('\0') || !compilerOptions.paths) {
14+
resolveId: (importee: string, importer?: string) => {
15+
if (typeof importer === 'undefined' || importee.startsWith('\0') || !compilerOptions.paths) {
1516
return null;
1617
}
1718

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"homepage": "https://github.com/simonhaenisch/rollup-plugin-typescript-paths#readme",
2323
"devDependencies": {
2424
"@types/node": "12.0.3",
25+
"rollup": "^1.31.1",
2526
"typescript": "^3.4.5"
2627
},
2728
"peerDependencies": {

0 commit comments

Comments
 (0)