Skip to content
This repository was archived by the owner on Aug 4, 2021. It is now read-only.

Commit 23ffe89

Browse files
committed
Fix how tslib is found
1 parent ba4583c commit 23ffe89

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

package-lock.json

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"dependencies": {
3131
"compare-versions": "2.0.1",
3232
"object-assign": "^4.0.1",
33+
"resolve": "^1.8.1",
3334
"rollup-pluginutils": "^1.3.1",
3435
"tippex": "^2.1.1",
3536
"tslib": ">=1.9.0",

rollup.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export default {
99
'path',
1010
'fs',
1111
'object-assign',
12+
'resolve',
1213
'rollup-pluginutils',
1314
'tippex',
1415
'typescript'

src/index.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import * as ts from 'typescript';
22
import { createFilter } from 'rollup-pluginutils';
3-
import * as path from 'path';
43
import * as fs from 'fs';
54
import assign from 'object-assign';
65
import compareVersions from 'compare-versions';
6+
import resolveId from 'resolve';
77

88
import { endsWith } from './string';
99
import { getDefaultOptions, compilerOptionsFromTsConfig, adjustCompilerOptions } from './options.js';
@@ -19,9 +19,8 @@ interface Options {
1919
}
2020
*/
2121

22-
// The injected id for helpers. Intentially invalid to prevent helpers being included in source maps.
23-
const helpersId = 'tslib';
24-
const helpersSource = fs.readFileSync( path.resolve( __dirname, '../node_modules/tslib/tslib.es6.js' ), 'utf-8' );
22+
const helpersId = '\0tslib';
23+
const helpersSource = fs.readFileSync(resolveId.sync('tslib/tslib.es6.js', { basedir: __dirname }), 'utf-8' );
2524

2625
export default function typescript ( options ) {
2726
options = assign( {}, options || {} );

0 commit comments

Comments
 (0)