Answer the question
In order to leave comments, you need to log in
How to properly configure webpack.config and linter?
I want to make for myself a small template for building a project using Webpack. I want to try using react hook, typescript. config looks like this
const path = require("path");
const webpack = require("webpack");
module.exports = {
entry: "./src/index",
output: {
path: path.resolve(__dirname, "public", "build"),
filename: "bundle.js",
publicPath: "/build/"
},
resolve: {
extensions: [".ts", ".tsx", ".js", ".json"]
},
module: {
rules: [
{
test: /\.(ts|js)x?$/,
exclude: /node_modules/,
use: ["babel-loader"]
}
]
},
devServer: {
contentBase: path.join(__dirname, "public"),
compress: true,
port: 9000,
host: "0.0.0.0",
historyApiFallback: true
}
};
{
"presets": [
"@babel/env",
"@babel/typescript",
"@babel/react"
],
"plugins": [
"@babel/proposal-class-properties",
"@babel/proposal-object-rest-spread"
]
}
{
"extends": [
"react-app",
"prettier"
],
"rules": {
"no-console": 2,
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
},
"parser": "@typescript-eslint/parser",
"plugins": [
"react-hooks",
"prettier"
]
}
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"noFallthroughCasesInSwitch": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"moduleResolution": "node",
"esModuleInterop": true,
"noUnusedLocals": true,
"noImplicitAny": true,
"target": "es2015",
"module": "es2015",
"strict": true,
"jsx": "react"
},
"include": ["src/**/*"],
"exclude": ["node_modules"]
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question