Trying to setup my local server in order to run rxjs code
Package.json
{
"name": "rxjs",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "webpack-dev-server --mode development"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"rxjs": "^7.5.4",
"ts-loader": "^9.2.6",
"typescript": "^4.5.5",
"webpack": "^5.68.0",
"webpack-dev-server": "^4.7.4"
},
"devDependencies": {
"webpack-cli": "^4.9.2"
}
}
ts config.json
{
"compilerOptions": {
"outDir": "./dist/",
"sourceMap": true,
"noImplicitAny": true,
"module": "es6",
"moduleResolution": "node",
"target": "es6",
"allowJs": true,
"lib": [
"es2017",
"dom"
]
}
}
webpack.config.js
const path = require('path');
module.exports = {
entry: './src/index.ts',
devtool: 'inline-source-map',
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/
}
]
},
devServer: {
historyApiFallback: true,
},
resolve: {
extensions: [ '.tsx', '.ts', '.js' ]
},
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist')
}
};
Index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>RxJS Demo</title>
<style>
body { font-family: 'Arial'; background: lightgray }
ul { list-style-type: none; padding: 20px; }
li { padding: 15px; background: lightcoral; margin-bottom: 10px; }
</style>
</head>
<body>
<h1>RxJS Demo</h1>
<div>
<ul id="list"></ul>
</div>
<script src="/bundle.js"></script>
</body>
</html>
index.ts
import * as RX from "rxjs";
console.log("hai",RX)
Here is my file structure
I tried npm run start and getting this