Reputation: 25359
I'm following the example given in Rxjs Subject:
import {Subject} from 'rxjs';
const subject = new Subject<number>();
// more code...
When running npx webpack I get the following error:
You may need an appropriate loader to handle this file type.
| import {Subject} from 'rxjs';
|
> const subject = new Subject<number>();
My webpack config is just barebones:
const path = require('path');
module.exports = {
entry: './js/index.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js'
},
mode: 'development'
};
Upvotes: 1
Views: 134
Reputation: 1765
The tutorial you're following is using Typescript syntax, whereas your webpack config doesn't seem to be handling typescript. You will need to investigate using typescript. A simple google search will give you many tutorials, but this is a good start: https://webpack.js.org/guides/typescript/
Alternatively, you could remove the typescript aspects from the example. They are generally the bits with<
, >
and :
Upvotes: 2