Skip to content

Unable to compile typescript after importing the latest version to my config files... #162

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
milewski opened this issue Oct 3, 2018 · 2 comments · Fixed by #163
Closed

Comments

@milewski
Copy link
Contributor

milewski commented Oct 3, 2018

Hi, i have been using old version of this plugin for quite a long time, recently i tried to upgrade to the latest and it doesn't compile my typescript files anymore. probably due to the .d.ts that is being shipped along with it now... Here is how im using it:

webpack.config.ts

import * as ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin'

...
plugins: [
     new ForkTsCheckerWebpackPlugin(),
]

error

tsc --lib esnext webpack/webpack.*.ts

node_modules/fork-ts-checker-webpack-plugin/lib/types/NormalizedMessage.d.ts:2:30 - error TS2307: Cannot find module 'tslint'.

2 import tslintTypes = require('tslint');
                               ~~~~~~~~

webpack/webpack.common.ts:8:45 - error TS2497: Module '"G:/Code/demo/node_modules/fork-ts-checker-webpack-plugin/lib/types/index"' r
esolves to a non-module entity and cannot be imported using this construct.

8 import * as ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin'
                                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] prestart: `tsc --lib esnext webpack/webpack.*.ts`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] prestart script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Rafael\AppData\Roaming\npm-cache\_logs\2018-10-03T11_37_04_173Z-debug.log

so once i forcibily install tslint (which im not using) and change

import * as ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin'

to

import ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin')

then so im able to "compile" my .ts config files...

anyways is it possible to change the auto generated .d.ts files to allow it to be imported as:

 import * as ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin'
 import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin'
 import { ForkTsCheckerWebpackPlugin } from 'fork-ts-checker-webpack-plugin'

anything but: 😞 

const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin')
import ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin')

and remove the forced dependency on tslint? or at least dont push the .d.ts to npm, perhaps publish to @types/fork-ts-checker-webpack-plugin?

@johnnyreilly
Copy link
Member

We want d.ts files to ship with fork-ts-checker-webpack-plugin. But if you'd like to submit a fix that improves them then we'd happily take a look!

@milewski
Copy link
Contributor Author

milewski commented Oct 4, 2018

@johnnyreilly i made a PR that fixes the import part.. but the TSLINT i wont be able to fix because the types of it are actually being used, only the lib itself is loaded on demand... there is no way to conditionally load that types in ts atm...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants