Skip to content

Is ts-loader ignoring my tsconfig file? #508

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
piernik opened this issue Mar 22, 2017 · 7 comments
Closed

Is ts-loader ignoring my tsconfig file? #508

piernik opened this issue Mar 22, 2017 · 7 comments

Comments

@piernik
Copy link

piernik commented Mar 22, 2017

I think ts-loader is ignoring my tsconfig file. In it I have set "traceResolution": true, and "outDir": "./dist/", but none logs for resolutions are displayed and no dist folder is created.
Here is my tsconfig.json

{
  "compilerOptions": {
    "module": "commonjs",
    "target": "es5",
    "sourceMap": true,
    "allowJs": true,
    "typeRoots": [
      "node_modules/@types"
    ],
    "traceResolution": true,
    "outDir": "./dist/",
    "baseUrl": ".",
    "paths": {
      "*": [
        "C:\\strony\\www\\libsJs\\*"
      ]
    }
  },
  "exclude": [
    "node_modules"
  ]
}

And webpack.config.js part:

module: {
        rules: [
            {
                test: /\.css$/i,
                use: ['style-loader', 'css-loader']
            },
            {
                test: /\.ts$/,
                use: [{
                    loader: 'ts-loader',
                }],
            },

both files are in root directory

@ddwwcruz
Copy link

Did you try

resolve: {
    extensions: [
        '.ts',
        '.tsx',
        '.js',
        '.jsx',
        '.json'
    ],
}

although this might not help with the outDir part.

@piernik
Copy link
Author

piernik commented Mar 29, 2017

Yes - have those

@Coridyn
Copy link

Coridyn commented Apr 17, 2017

Where is your tsconfig.json in relation to your source files - what does your project structure look like?

@jonaskello
Copy link
Contributor

If you are expecting ts-loader to resolve according to your baseUrl and paths section of tsconfig.json I think that will not work out-of-the-box. I've made a webpack plugin that adds that resolving, you can find it here: tsconfig-paths-webpack-plugin

@johnnyreilly
Copy link
Member

Thanks for sharing @jonaskello - it's not functionality I use and so I've never paid too much attention to it. That said, it's clearly valued by others. Would you fancy adding something to ts-loader's readme to point people who want that functionality towards your plugin?

@jonaskello
Copy link
Contributor

@johnnyreilly I actually made #693 just today for that :-). I'll go ahead and do a PR too.

@johnnyreilly
Copy link
Member

Thanks!

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

5 participants