Skip to content
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

ts-loader and webpack 2.0 #195

Closed
olegstepura opened this issue May 12, 2016 · 7 comments
Closed

ts-loader and webpack 2.0 #195

olegstepura opened this issue May 12, 2016 · 7 comments

Comments

@olegstepura
Copy link

Hi!

Just want to know if ts-loader is ready for webpack 2.0? I tried to switch my app, which correctly works with latest webpack 1.x, to webpack 2.0 and got bunch of typescript module resolve errors.

I'm using paths relative from root for imports. Like this:
(4ex: file container\Home\HomePage.tsx)

import Logger from 'common/util/logger'

folder structure for this:

+ root
|
+- container / Home / HomePage.tsx 
+- common / util / logger.tsx

my tsconfig:

{
  "compilerOptions": {
    "target": "es6",
    "module": "es6",
    "moduleResolution": "node",
    "allowJs": true,
    "experimentalDecorators": true,
    "allowSyntheticDefaultImports": true,
    "removeComments": false,
    "noImplicitAny": false,
    "inlineSourceMap": true,
    "jsx": "react",
    "rootDir": "src/main",
    "outDir": "target/typescript"
  },
  "exclude": [
    "node_modules",
    "typings",
  ]
}

webpack was reconfigured according to changes noted here: https://gist.github.com/sokra/27b24881210b56bbaff7

@aaalsubaie
Copy link

it works for me but too slow!

@quantuminformation
Copy link

@aaalsubaie doesn't work for me:

└── UNMET PEER DEPENDENCY webpack@2.1.0-beta.21

npm WARN webpack-dev-server@1.14.1 requires a peer of webpack@>=1.3.0 <3 but none was installed.

@blakeembrey
Copy link
Member

blakeembrey commented Sep 10, 2016

@quantuminformation That warning is unrelated. It actually says right there that the warning is coming from webpack-dev-server and is not related to this issue.

@rasentry
Copy link

rasentry commented Sep 26, 2016

ts_loader does not add webpack's options.resolve.modules to module resolver. As workaround need add to tsconfig

{
  "compilerOptions": {   
    "paths": {
      "*": [
        "tosrc1/*",
        "tosrc2/*"
      ]
    }
  },
}

@oojacoboo
Copy link

@rasentry that actually helped some for me, thanks.

I'm still wondering about this. There doesn't seem to be much talk about webpack 2 support here. I realize it's still beta, but it's been in beta for a while too. Documentation is VERY sparse. I can't even locate any docs on the webpack 2 config format and details. I've seen some bits and pieces, but that's about it.

I'm getting all kinds of module resolving issues here. At first I was having issues with the webpack entry file and had to directly pass it to ts-loader!index.tsx. This at least gets my entry loading, but now it's having issues resolving modules that are imported into the entry file.

Any direction/help would be greatly appreciated here. If anyone has this working, a little write-up would be huge. At the least, a working webpack config and tsconfig. Thanks.

@johnnyreilly
Copy link
Member

@oojacoboo you might want to take a look at #283 - this may help

@wpitallo
Copy link

I have tried to use this with webpack 2 but it is very very very slow :(

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

No branches or pull requests

8 participants