I'm trying my hands on creating a template for React with Typescript.
To use it in a productive Environment I want to bundle it with a webpack.
As far as my research goes I should have configured everything correctly.
As follows
webpack.config.ts
const path = require('path'); module.exports = { mode: "development", entry: { app: path.join(__dirname, 'src', 'index.tsx') }, target: 'web', module: { rules: [ { test: /\.tsx?$/, use: 'ts-loader', include: [ path.resolve(__dirname, 'ts') ], }, { enforce: "pre", test: "/\.js$/", loader: "source-map-loader" } ] }, resolve: { extensions: [ '.tsx', '.ts', '.js' ], }, output: { filename: 'index.js', path: path.resolve(__filename, 'js') }, devtool: 'source-map', }; tsconfig.json
{ "compilerOptions": { "target": "ES6", "module": "CommonJS", "outDir": "./js/", "preserveConstEnums": true, "moduleResolution": "Node", "sourceMap": true, "removeComments": true, "jsx": "react" }, "include": [ "./ts/**/*" ] } package.json
{ "name": "reacttest", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "build": "webpack --config webpack.config.ts" }, "keywords": [], "author": "", "license": "ISC", "devDependencies": { "@types/node": "^14.0.14", "@types/react": "^16.9.41", "@types/react-dom": "^16.9.8", "html-webpack-plugin": "^4.3.0", "source-map-loader": "^1.0.0", "ts-loader": "^7.0.5", "typescript": "^3.9.5", "webpack": "^4.43.0", "webpack-cli": "^3.3.12" }, "dependencies": { "react": "^16.13.1", "react-dom": "^16.13.1" } } But every time I run
webpack or
webpack --config webpack.config.ts or
webpack webpack.config.ts I get the following error message
Error: EEXIST: file already exists, mkdir '\Some\Path\WebWorkspace\reacttest\webpack.config.ts'
What am I doing wrong?
Is tried it with both
NodeJs 13.7
and
NodeJs v12.18.1
Thanks in Advance