diff --git a/.npmignore b/.npmignore index 9931d45d5..63aecf2e9 100644 --- a/.npmignore +++ b/.npmignore @@ -1,5 +1,6 @@ *.ts .vscode .test +examples test src diff --git a/CHANGELOG.md b/CHANGELOG.md index ad4546cab..bd1fab537 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## v3.0.3 + +- [Fix allowJs @types resolution error](https://github.com/TypeStrong/ts-loader/pull/658) (#657, #655) - thanks @johnnyreilly and @roddypratt + @ldrick for providing minimal repro repos which allowed me to fix this long standing bug! + +This fix resolves the issue for TypeScript 2.4+ (which is likely 95% of users). For those people stuck on 2.4 and impacted by this issue, you should be able to workaround this by setting `entryFileCannotBeJs: true` in your ts-loader options. This option should be considered deprecated as of this release. The option will likely disappear with the next major version of ts-loader which will drop support for TypeScript 2.3 and below, thus removing the need for this option. + ## v3.0.0 All changes were made with this [PR](https://github.com/TypeStrong/ts-loader/pull/643) - thanks @johnnyreilly diff --git a/README.md b/README.md index 2361ba07c..869e4ca26 100644 --- a/README.md +++ b/README.md @@ -296,9 +296,11 @@ Advanced option to force files to go through different instances of the TypeScript compiler. Can be used to force segregation between different parts of your code. -#### entryFileCannotBeJs *(boolean) (default=false)* +#### entryFileCannotBeJs *(boolean) (default=false) DEPRECATED* -If the `allowJs` compiler option is `true` then it's possible for your entry files to be JS. Since people have reported occasional problems with this the `entryFileCannotBeJs` setting exists to disable this functionality (if set then your entry file cannot be JS). Please note that this is rather unusual and will generally not be necessary when using `allowJs`. This option may be removed in a future version of ts-loader if it appears to be unused (likely). +If the `allowJs` compiler option is `true` then it's possible for your entry files to be JS. There is a [known issue using ts-loader with TypeScript 2.3 and below](https://github.com/TypeStrong/ts-loader/issues/655). This option exists to work around that issue if you are using ts-loader with TypeScript 2.3 or below. + +This option will be removed in a future version of ts-loader. #### appendTsSuffixTo *(RegExp[]) (default=[])* #### appendTsxSuffixTo *(RegExp[]) (default=[])* diff --git a/package.json b/package.json index 6753a5104..7337f5547 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ts-loader", - "version": "3.0.2", + "version": "3.0.3", "description": "TypeScript loader for webpack", "main": "index.js", "scripts": { diff --git a/src/index.ts b/src/index.ts index ca42a03f6..907f3bfa8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -110,7 +110,7 @@ function getLoaderOptions(loader: Webpack) { } type ValidLoaderOptions = keyof LoaderOptions; -const validLoaderOptions: ValidLoaderOptions[] = ['silent', 'logLevel', 'logInfoToStdOut', 'instance', 'compiler', 'configFile', 'transpileOnly', 'ignoreDiagnostics', 'errorFormatter', 'colors', 'compilerOptions', 'appendTsSuffixTo', 'appendTsxSuffixTo', 'entryFileCannotBeJs', 'happyPackMode', 'getCustomTransformers']; +const validLoaderOptions: ValidLoaderOptions[] = ['silent', 'logLevel', 'logInfoToStdOut', 'instance', 'compiler', 'configFile', 'transpileOnly', 'ignoreDiagnostics', 'errorFormatter', 'colors', 'compilerOptions', 'appendTsSuffixTo', 'appendTsxSuffixTo', 'entryFileCannotBeJs' /* DEPRECATED */, 'happyPackMode', 'getCustomTransformers']; /** * Validate the supplied loader options. diff --git a/src/interfaces.ts b/src/interfaces.ts index 106b85ac3..acbc93d14 100644 --- a/src/interfaces.ts +++ b/src/interfaces.ts @@ -273,6 +273,7 @@ export interface LoaderOptions { compilerOptions: typescript.CompilerOptions; appendTsSuffixTo: RegExp[]; appendTsxSuffixTo: RegExp[]; + /** DEPRECATED */ entryFileCannotBeJs: boolean; happyPackMode: boolean; getCustomTransformers?(): typescript.CustomTransformers | undefined;