Skip to content

Commit

Permalink
- updates to readme and removing moduleResolution override
Browse files Browse the repository at this point in the history
  • Loading branch information
ezolenko committed Jul 14, 2023
1 parent c3be8b2 commit 308eb8f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
6 changes: 5 additions & 1 deletion README.md
Expand Up @@ -48,13 +48,17 @@ This also allows for passing in different `tsconfig` files depending on your bui
* `inlineSourceMap`: false (see [#71](https://github.com/ezolenko/rollup-plugin-typescript2/issues/71))
* `outDir`: `./placeholder` in cache root (see [#83](https://github.com/ezolenko/rollup-plugin-typescript2/issues/83) and [Microsoft/TypeScript#24715](https://github.com/Microsoft/TypeScript/issues/24715))
* `declarationDir`: Rollup's `output.file` or `output.dir` (*unless `useTsconfigDeclarationDir` is true in the plugin options*)
* `moduleResolution`: *`classic` is [deprecated](https://www.typescriptlang.org/docs/handbook/module-resolution.html) and changed to `node`. It also breaks this plugin, see [#12](https://github.com/ezolenko/rollup-plugin-typescript2/issues/12) and [#14](https://github.com/ezolenko/rollup-plugin-typescript2/issues/14)*). All other values are passed through. Rollup might have problems with some of them, so if in doubt, use `node`.
* `allowNonTsExtensions`: true to let other plugins on the chain generate typescript; update plugin's `include` filter to pick them up (see [#111](https://github.com/ezolenko/rollup-plugin-typescript2/issues/111))

### Some compiler options have more than one compatible value

* `module`: defaults to `ES2015`. Other valid values are `ES2020`, `ES2022` and `ESNext` (required for dynamic imports, see [#54](https://github.com/ezolenko/rollup-plugin-typescript2/issues/54)).

* `moduleResolution`: defaults to `node10` (same as `node`), but value from tsconfig is used if specified. Other valid (but mostly untested) values are `node16`, `nodenext` and `bundler`. If in doubt, use `node10`.

`classic` is [deprecated](https://www.typescriptlang.org/docs/handbook/module-resolution.html) and changed to `node10`. It also breaks this plugin, see [#12](https://github.com/ezolenko/rollup-plugin-typescript2/issues/12) and [#14](https://github.com/ezolenko/rollup-plugin-typescript2/issues/14).


### Some options need additional configuration on plugin side

* `allowJs`: lets TypeScript process JS files as well. If you use it, modify this plugin's `include` option to add `"*.js+(|x)", "**/*.js+(|x)"` (might also want to `exclude` `"**/node_modules/**/*"`, as it can slow down the build significantly).
Expand Down
1 change: 0 additions & 1 deletion __tests__/get-options-overrides.spec.ts
Expand Up @@ -27,7 +27,6 @@ const forcedOptions: ts.CompilerOptions = {
noEmitHelpers: false,
noResolve: false,
outDir: `${cacheDir}/placeholder`,
moduleResolution: ts.ModuleResolutionKind.Node10,
};

const defaultPreParsedTsConfig: ts.ParsedCommandLine = {
Expand Down
1 change: 0 additions & 1 deletion src/get-options-overrides.ts
Expand Up @@ -17,7 +17,6 @@ export function getOptionsOverrides({ useTsconfigDeclarationDir, cacheRoot }: IO
inlineSourceMap: false,
outDir: normalize(`${cacheRoot}/placeholder`), // need an outdir that is different from source or tsconfig parsing trips up. https://github.com/Microsoft/TypeScript/issues/24715
allowNonTsExtensions: true,
moduleResolution: tsModule.ModuleResolutionKind.Node10,
};

if (!preParsedTsconfig)
Expand Down

0 comments on commit 308eb8f

Please sign in to comment.