ts-loader seems not to load modules from node_modules, but awesome-typescript-loader does
See original GitHub issueHello! I eventullay discovered that ts loader won’t load modules from node_modules for some reason. For example, i have some entry file, like this, and tere is @somespace/foo/index.ts
file:
// index.ts
import {Foo} from "@somespace/foo"
I enableTypeScriptLoader
and all my in-project ts is ok. But when trying to import some ts stuff from node_modules it says:
Error loading ./node_modules/@somespace/foo/index.ts
FIX To process TypeScript files:
1. Add Encore.enableTypeScriptLoader() to your webpack.config.js file.
When i replaced built-in ts-loader
with awesome-typescript-loader
, the problem has gone, and everthing has compiled well.
So, why webpack-encore uses ts-loader, and not awesome-typescript-loader?
Issue Analytics
- State:
- Created 6 years ago
- Comments:9
Top Results From Across the Web
2 - Stack Overflow
awesome-typescript-loader is no longer maintained and is not compatible with Webpack 5 (or with recent TypeScript versions).
Read more >s-panferov/awesome-typescript-loader - Gitter
Hi. I'm trying to upgrade an application from webpack 1 to 2 and cannot because it relies heavily on webpack aliasing (but not...
Read more >Compiling and bundling TypeScript libraries with Webpack
There are a couple of TS loaders and we eventually settled on awesome-typescript-loader for a couple of reasons: it's faster, by forking the...
Read more >TypeScript Config - Storybook
This is a central reference for using Storybook with TypeScript. Setting up TypeScript with awesome-typescript-loader. Dependencies you may need.
Read more >Handbook - React & Webpack - TypeScript
How to use TypeScript with React and Webpack. ... Please note that ts-loader is not the only loader for typescript.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Maybe we could add a second parameter to
Encore.enableTypeScriptLoader()
to change theexclude
rule or include somenode_modules
the same wayEncore.configureBabel()
works?Note that in the meantime you can use
Encore.configureLoaderRule()
as a cleaner workaround:May be some configuration option can be introduced? `cause we have lots of internal packages in our organization, written in pure typescript, that are consumed and compiled by some end-projects, and there is no need to pre-build those packages.