Comments (9)
I'm glad this helped you!
I believe it will if you tell it to in
tsconfig.json
, right?
Good point, I'm wondering if the plugin should read tsconfig.json
to decide what to compile. That wouldn't be too difficult to do because the TypeScript compiler exposes an API for this.
from resolve-typescript-plugin.
I'm not knowledgeable enough about resolvers to speak to the second item, and while it would be nice to have built into common configs using ts-loader or babel-loader with the typescript plugin, I think it's fine having it in a separate plugin as long as it's visible and documented somewhere.
As for the other items, I am currently using a private dependency that currently intentionally publishes .ts
files, which by default isn't handled by this plugin (as noted in items 3 and 4 in your comment above). My current quick hack so I could get something built yesterday evening was to just delete the node_modules
check, which worked fine. So I think it would be great if there were a way to opt into dependencies being resolved using this plugin as well, whether by default (which didn't seem to cause any significant build time increases) or via an option.
TypeScript itself won't compile source files resolved from node_modules when you compile with tsc.
I believe it will if you tell it to in tsconfig.json
, right?
I plan on putting something together and submitting a PR to opt out of the node_modules
check entirely this weekend hopefully.
Thanks for putting this plugin together! It saved me from an annoying headache at 5:30pm on a Friday before a long holiday weekend! 😄
from resolve-typescript-plugin.
thanks for your work on this plugin. it helped me in my storybook webpack setup
from resolve-typescript-plugin.
I would also like to leave a word of thanks here. I can't believe the behaviour that this plugin adds isn't provided by default in webpack as it seems like such a common problem to me. Though the automagical .js
-import logic of the TypeScript compiler seems like the root culprit. Why not just allow .ts
-imports and compile them to .js
-imports along with everything else?
In my use case, I've been using TypeORM which provides both a programmatic interface as well as a CLI to interact with the ORM/database entities. Both use the same files and as my project is bundled with webpack, they are incompatible with each other.
The CLI runs on (ts-)node which expects ESM compatibility with full file extensions in imports while webpack explodes when trying to find TypeScript files as .js
-imports. Meanwhile, webpack could technically handle .ts
-imports, but then the TypeScript compiler/intellisense complains that it can't make sense of it.
Its like trying to please three divas at once and one is always complaining no matter what.
I've found that you can workaround it by either adding // @ts-ignore
above the .ts
-imports to please the TypeScript compiler (at least when used with ts-loader) or making the CLI run with --experimental-specifier-resolution=node
when not specifying file extensions, but you plugin seems a lot more elegant.
from resolve-typescript-plugin.
This functionality is now built in to webpack, see https://github.com/softwareventures/resolve-typescript-plugin#obsolete
from resolve-typescript-plugin.
Pinging microsoft/TypeScript#16577 in the hope that people who need this plugin will see it.
from resolve-typescript-plugin.
@djcsdy does this plugin work with webpack 4 as well?
from resolve-typescript-plugin.
trying to get it implemented here: storybookjs/storybook#15973
from resolve-typescript-plugin.
@djcsdy does this plugin work with webpack 4 as well?
@lifeiscontent it should do, although I haven't tested it. If not please file a bug.
from resolve-typescript-plugin.
Related Issues (15)
- Yarn cache should be ignored when published to npm registry HOT 2
- Run npm deprecate on this package HOT 3
- typo error in doc HOT 2
- Does not work with webpack 4 HOT 6
- For JS/TS code that is not inside of a package that adds "type": "module", default to original behavior. HOT 3
- Support .mjs, .mts extensions HOT 2
- TypeScript cannot resolve type of this plugin itself HOT 3
- Provide a ESM export? HOT 11
- perf: Register fewer hooks HOT 1
- Links in README.md are mismatched HOT 2
- Test projects recursively copy themselves into node_modules HOT 1
- Monorepo workspace dependencies and perf HOT 1
- Obsolete HOT 1
- Action Required: Fix Renovate Configuration
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from resolve-typescript-plugin.