sometimes all files that should be passed are not passed to loaders
See original GitHub issueBug report
What is the current behavior?
I have a ts / js / tsx / jsx
loader like this:
module: {
rules: [
{
test: /\.[jt]sx?$/,
include: [/src/],
exclude: [/node_modules/, /server/],
use: [
{
loader: 'babel-loader',
// ...
},
},
{
loader: 'ts-loader',
// ...
},
],
},
But it doesn’t pass all .ts
files to the ts-loader
first, and because of that I get the unexpected token error:
ERROR in ./wireWebapp/src/script/ui/viewportObserver.ts 26:15
Module parse failed: Unexpected token (26:15)
File was processed with these loaders:
* ./node_modules/@pmmmwh/react-refresh-webpack-plugin/loader/index.js
You may need an additional loader to handle the result of these loaders.
|
| const observedElements = new Map();
> const tolerance: number = 0.8;
|
| const onIntersect: IntersectionObserverCallback = entries => {
If the current behavior is a bug, please provide the steps to reproduce. Minimal reproducible example: GitHub
What is the expected behavior?
It should pass all tsx/jsx/js/ts
files to the appropriate loader, and not “most” of them. Maybe my config is wrong, but the include
specifies that all file-paths that include src
in them and have a ts/js/tsx/jsx
extension should be processed by the babel-loader
& ts-loader
combo, but instead it is not passed at all.
Other relevant information: webpack version:
webpack: 5.64.3
webpack-cli: 4.9.1
webpack-dev-server 4.5.0
Node.js version: v14.18.1
/ v15.14.0
Operating System: 5.10.70-1-MANJARO
Additional tools: -
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top GitHub Comments
Thank you so much! I missed it completely 😅
yep
Observer
matches/server/
so it’s excluded.