-
Notifications
You must be signed in to change notification settings - Fork 181
Types do not work #443
Comments
Do you have |
same issue with "awesome-typescript-loader": "^3.2.1",
all of these types are installed. tsconfig.json: {
"compilerOptions": {
"removeComments": false,
"sourceMap": false,
"noImplicitAny": false,
"module": "commonjs",
"moduleResolution": "node",
"jsx": "react",
"target": "es5",
"lib": ["dom", "es6"],
"declaration": false,
"noEmitOnError": true,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"types": [
"node",
"mocha",
"jasmine",
"underscore",
"chrome"
]
},
"include": [
"src/**/*",
"specs/**/*"
],
"exclude": [
"dev/**/*",
"dist/**/*"
]
} webpack.config.js module.exports = {
entry: "./app/index.tsx",
output: {
filename: "index.js",
path: __dirname + "/app/dev/build/"
},
devtool: "source-map",
resolve: {
extensions: [".ts", ".tsx", ".js", ".json"]
},
module: {
rules: [
{ test: /\.tsx?$/, loader: "awesome-typescript-loader?configFileName=app/tsconfig.json"},
{ enforce: "pre", test: /\.js$/, loader: "source-map-loader" }
]
},
externals: {
"react": "React",
"react-dom": "ReactDOM"
},
}; |
I have the same issue was able to resolve it by simply adding the typeRoots element to compilerOptions as seen below. I think it's because in our cases we were overriding the config file name. I had to override the config file because ts-node picks up my tsconfig.json in order to write my webpack.config in typescript.
|
Hi, I came across this issue today, as one person in our team had the issue but nobody else could recreate it. After some digging, I have found that it was a Windows only issue, which is possibly why many people have failed to recreate it. I initially started investigating the issue using Ubuntu on windows for bash, as opposed to any of the windows command line options, and I couldn't recreate the issue. After purging all dependency folders and reinstalling via powershell/cmd then the issue started to arise, and by following the fix mentioned by @buvinghausen, everything seems to be working fine. So by that note I think that this defect is still in the current codebase, and it only effects the windows command line, and it also only effects people with a custom configFileName, if they are depending on the default property for typeRoots (which is by default set to [ "./node_modules/@types" ]). To recreate the issue, use the configFileName option to point to a file that extends a tsconfig file that is known to work. USING A WINDOWS MACHINE (with windows command line):
{
"extends": "./tsconfig.json",
} run the build and it will fail |
I seem to be in the condition @Nibblesh describes. I'm using Windows 10, my project setup has a custom Can this issue be re-opened? |
I have had the same issue where @types are not automatically included in the build when using:
Specifically not importing Using configFileName does not seem to work on the windows command prompt with the following rule:
This does however work using WSL Bash on Windows 10. As i don't have a custom tsconfig name and dont need the config option my fix is to just remove it. |
@s-panferov this seems to still be a problem: palantir/blueprint#2367. can we re-open the issue to address the bug? |
I encountered this problem today (on Windows 10). I created a custom tsconfig for our karma/jasmine tests to get around performance issues with typescript. I was confused as anything by all the missing global type definitions, such as those for jasmine. |
In a project I have installed several @types:
And I have the latest awesome-typescript-loader:
When I build my project, I see messages in the command line output such as:
I tried added a
types
key to my .tsconfig for Node and Jasmine, e.g:But in this case, the message in the command line output changes to this:
The .tsconfig file is at the root of the project, at the same level as the node_modules folder.
Changing to the ts-loader fixes the issue without additional config changes (other than using
ts-loader
in webpack.config.js instead ofawesome-typescript-loader
)The text was updated successfully, but these errors were encountered: