-
-
Notifications
You must be signed in to change notification settings - Fork 429
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 ignores resolve.extensions
order
#1198
Comments
@davismj, I would be happy to look at a minimal repo which demonstrates the issue but I have the following comments which may be helpful. I believe that resolve.extensions is part of webpack and is not used by ts-loader. webpack uses resolve.extensions to resolve files and then passes the file it resolved to ts-loader (if it is a .ts file). Typescript has a separate module resolution system, which is described at https://www.typescriptlang.org/docs/handbook/module-resolution.html You can control TypeScript's module resolution using tsconfig.json. It is possible that Typescript and webpack will resolve files differently. You have use a plugin (tsconfig-paths-webpack-plugin) to get webpack to mirror the paths in tsconfig.json, which helps to keep them in sync. If I understand your need correctly I would configure application B to output its .js files to directory 'build_b' then I would configure the tsconfig.json for application A to resolve files from the 'build_b' directory. In this case it should resolve the built .js files instead of the source .ts files. If you output the .js files to the same directory as the source .ts files you will find it hard to resolve them apart. If you need further help I would be pleased to look at a minimal repo. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Closing as stale. Please reopen if you'd like to work on this further. |
Motivation
I have a monorepo structure where I have separate processes building separate and differently configured typescript applications concurrently. Since application A is configured differently from application B, trying to build application B with application A configuration yields numerous errors. Instead, I want application A to load and transpile its own TypeScript files, but I want application A to load the built JavaScript files and ignore the source TypeScript from application B.
Expected Behaviour
Using the following webpack configuration:
I would expect that the following code would resolve
test.js
and ignoretest.ts
frommain.ts
.main.ts
Actual Behaviour
Using the above configuration, ts-loader loads
test.ts
and ignorestest.js
. To verify, I dropped a deliberate typing error in 'test.ts', leaving the old and working 'test.js' in tact.Which yields an error on build:
Steps to Reproduce the Problem
resolve.extensions = ['.js', '.ts']
Location of a Minimal Repository that Demonstrates the Issue.
On request.
The text was updated successfully, but these errors were encountered: