-
I have a legacy app that despite some configuration it doesn't work properly. Nodemon doesn't restart on .ts file changes and I can't figure out how to make it working. What I could try to make .ts to work too. I would appreciate any suggestions.
Extensions flag doesn't seem to be respected by nodemon here?
package.json
{
"name": "xxx",
"private": true,
"version": "1.0.0",
"description": "xxx",
"scripts": {
"lint": "npx eslint ./ --ignore-path .gitignore",
"lint-fix": "pnpm lint -- --fix",
"start:dev-server": "NODE_ENV=development BABEL_ENV=browser npx webpack-dev-server",
"start:nodemon": "DEBUG= NODE_ENV=development BABEL_ENV=node nodemon --exec babel-node ./src/index.js --inspect=0.0.0.0 --extensions \".ts,.tsx,.js\" --watch ./src/server",
"start": "./bin/start",
"test": "jest --config=jest.config.js --runInBand",
"test:watch": "jest --config=jest.config.js --watch",
"test:coverage": "jest --config=jest.config.js --coverage --colors",
"integration-test": "test/run_tests.sh",
"build": "rm -rf ./dist && pnpm build-client && pnpm build-server",
"build-server": "BABEL_ENV=node babel ./src -d ./dist --ignore spec.js --extensions \".ts,.tsx,.js\" --copy-files",
"build-client": "BABEL_ENV=browser webpack --mode=development",
"check-node-version": "node --version",
"prettier": "@imaginary-cloud/prettier-config",
"format": "prettier --write \"{,!(node_modules)/**/}*.(ts|tsx|js|jsx|scss|css|md)\"",
"preinstall": "npx only-allow pnpm",
"prepare": "./bin/check_husky.sh"
},
"engines": {
"node": ">=14.18.1 <15",
"npm": ">=6.14"
},
"pnpm": {
"overrides": {
"acorn": "npm:acorn@8.8.1"
}
},
"dependencies": {
"@babel/runtime": "7.16.3",
"@nadavshaar/react-grid-table": "1.1.2",
"@tanstack/react-query": "4.19.1",
"@tanstack/react-query-devtools": "4.19.1",
"@trpc/client": "10.5.0",
"@trpc/react-query": "10.5.0",
"@trpc/server": "10.5.0",
"@types/bingmaps": "0.0.1",
"@types/react-dom": "16.8.4",
"@types/react-redux": "7.1.2",
"@types/react-router": "3.0.8",
"@types/request": "2.48.3",
"animate.css": "3.7.2",
"array.prototype.flatmap": "1.2.1",
"body-parser": "1.19.0",
"classnames": "2.2.6",
"clipboard": "2.0.10",
"config": "3.1.0",
"connect-redis": "5.0.0",
"cookie-parser": "1.4.4",
"core-js": "2.6.9",
"es6-promise": "4.2.8",
"express": "4.17.1",
"express-session": "1.16.2",
"express-winston": "3.2.1",
"helmet": "3.21.1",
"history": "4.9.0",
"immutable": "3.8.2",
"isomorphic-fetch": "2.2.1",
"js-file-download": "0.4.4",
"lodash": "4.17.15",
"memorystore": "1.6.1",
"moment": "2.24.0",
"multer": "1.4.2",
"object-diff": "0.0.4",
"object-path": "0.11.4",
"polished": "3.4.1",
"prop-types": "15.7.2",
"query-string": "5.1.1",
"react": "16.8.6",
"react-dom": "16.8.6",
"react-error-boundary": "3.1.4",
"react-form": "4.0.1",
"react-hook-form": "4.3.0",
"react-icons": "3.9.0",
"react-redux": "6.0.1",
"react-router": "3.2.0",
"react-router-redux": "4.0.8",
"react-select": "2.4.2",
"react-tooltip": "4.1.2",
"react-transition-group": "2.7.1",
"redis": "3.0.2",
"redux": "4.0.4",
"redux-immutable": "4.0.0",
"redux-logger": "3.0.6",
"redux-thunk": "2.3.0",
"serialize-javascript": "2.1.0",
"styled-components": "4.3.2",
"superjson": "1.12.0",
"typesafe-actions": "3.3.0",
"url-assembler": "2.0.0",
"uuid": "3.3.3",
"why-did-you-update": "0.1.1",
"winston": "3.3.3",
"winston-daily-rotate-file": "4.5.0",
"zod": "3.20.2"
},
"devDependencies": {
"@babel/cli": "7.5.0",
"@babel/core": "7.5.0",
"@babel/node": "7.5.0",
"@babel/plugin-proposal-class-properties": "7.5.5",
"@babel/plugin-proposal-decorators": "7.4.4",
"@babel/plugin-proposal-do-expressions": "7.5.0",
"@babel/plugin-proposal-export-default-from": "7.5.2",
"@babel/plugin-proposal-export-namespace-from": "7.5.2",
"@babel/plugin-proposal-function-bind": "7.2.0",
"@babel/plugin-proposal-function-sent": "7.5.0",
"@babel/plugin-proposal-json-strings": "7.2.0",
"@babel/plugin-proposal-logical-assignment-operators": "7.2.0",
"@babel/plugin-proposal-nullish-coalescing-operator": "7.4.4",
"@babel/plugin-proposal-numeric-separator": "7.2.0",
"@babel/plugin-proposal-object-rest-spread": "7.5.5",
"@babel/plugin-proposal-optional-chaining": "7.2.0",
"@babel/plugin-proposal-pipeline-operator": "7.5.0",
"@babel/plugin-proposal-throw-expressions": "7.2.0",
"@babel/plugin-syntax-dynamic-import": "7.2.0",
"@babel/plugin-syntax-import-meta": "7.2.0",
"@babel/plugin-transform-runtime": "7.5.5",
"@babel/preset-env": "7.5.2",
"@babel/preset-react": "7.0.0",
"@babel/preset-typescript": "7.3.3",
"@babel/register": "7.4.4",
"@imaginary-cloud/eslint-config-react": "1.0.1",
"@imaginary-cloud/prettier-config": "1.0.0",
"@types/isomorphic-fetch": "0.0.35",
"@types/jest": "26.0.23",
"@types/lodash": "4.14.175",
"@types/node": "16.4.5",
"@types/react": "16.8.23",
"@types/uuid": "3.4.5",
"@typescript-eslint/eslint-plugin": "3.5.0",
"@typescript-eslint/parser": "3.5.0",
"assets-webpack-plugin": "3.9.10",
"awesome-typescript-loader": "5.2.1",
"babel-eslint": "10.0.3",
"babel-loader": "8.0.6",
"babel-plugin-react-transform": "3.0.0",
"babel-plugin-transform-require-ignore": "0.1.1",
"babel-polyfill": "6.26.0",
"css-loader": "2.1.1",
"enzyme": "3.11.0",
"enzyme-adapter-react-16": "1.15.6",
"eslint": "7.30.0",
"eslint-config-airbnb": "18.2.1",
"eslint-config-airbnb-typescript": "8.0.2",
"eslint-config-prettier": "6.15.0",
"eslint-import-resolver-typescript": "2.0.0",
"eslint-plugin-import": "2.23.4",
"eslint-plugin-jsx-a11y": "6.4.1",
"eslint-plugin-prettier": "3.4.0",
"eslint-plugin-react": "7.24.0",
"eslint-plugin-react-hooks": "4.2.0",
"eslint-plugin-unused-imports": "1.1.2",
"fetch-mock": "7.3.9",
"file-loader": "3.0.1",
"husky": "7.0.4",
"identity-obj-proxy": "3.0.0",
"jest": "27.0.6",
"jsdom": "9.12.0",
"lint-staged": "11.0.0",
"mini-css-extract-plugin": "0.5.0",
"node-sass": "4.14.1",
"nodemon": "2.0.20",
"npm-run-all": "4.1.5",
"prettier": "2.3.2",
"pretty-quick": "3.1.1",
"react-docgen-typescript-loader": "3.6.0",
"react-docgen-typescript-webpack-plugin": "1.1.0",
"redis": "3.0.2",
"sass-loader": "7.1.0",
"style-loader": "0.23.1",
"ts-jest": "27.0.3",
"ts-loader": "5.3.3",
"ts-node": "10.9.1",
"typescript": "4.9.4",
"webpack": "4.35.3",
"webpack-cli": "3.3.9",
"webpack-dev-server": "3.7.2"
}
} .babelrc
{
"env": {
"browser": {
"presets": [
[
"@babel/preset-env",
{
"modules": "commonjs",
"targets": {
"browsers": [
"ie 9"
]
}
}
],
"@babel/preset-react",
"@babel/preset-typescript"
],
"plugins": [
"@babel/plugin-syntax-dynamic-import",
"@babel/plugin-syntax-import-meta",
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-json-strings",
[
"@babel/plugin-proposal-decorators",
{
"legacy": true
}
],
"@babel/transform-runtime",
"@babel/plugin-proposal-function-sent",
"@babel/plugin-proposal-export-namespace-from",
"@babel/plugin-proposal-numeric-separator",
"@babel/plugin-proposal-throw-expressions",
"@babel/plugin-proposal-export-default-from",
"@babel/plugin-proposal-logical-assignment-operators",
"@babel/plugin-proposal-optional-chaining",
[
"@babel/plugin-proposal-pipeline-operator",
{
"proposal": "minimal"
}
],
"@babel/plugin-proposal-nullish-coalescing-operator",
"@babel/plugin-proposal-do-expressions",
"@babel/plugin-proposal-function-bind",
"@babel/proposal-object-rest-spread"
]
},
"node": {
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": "current"
}
}
],
"@babel/preset-react",
"@babel/preset-typescript"
],
"plugins": [
[
"babel-plugin-transform-require-ignore",
{
"extensions": [
".css",
".sass",
".scss"
]
}
],
"@babel/plugin-syntax-dynamic-import",
"@babel/plugin-syntax-import-meta",
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-json-strings",
[
"@babel/plugin-proposal-decorators",
{
"legacy": true
}
],
"@babel/transform-runtime",
"@babel/plugin-proposal-function-sent",
"@babel/plugin-proposal-export-namespace-from",
"@babel/plugin-proposal-numeric-separator",
"@babel/plugin-proposal-throw-expressions",
"@babel/plugin-proposal-export-default-from",
"@babel/plugin-proposal-logical-assignment-operators",
"@babel/plugin-proposal-optional-chaining",
[
"@babel/plugin-proposal-pipeline-operator",
{
"proposal": "minimal"
}
],
"@babel/plugin-proposal-nullish-coalescing-operator",
"@babel/plugin-proposal-do-expressions",
"@babel/plugin-proposal-function-bind"
]
}
}
} tsconfig.json
{
"compilerOptions": {
"sourceMap": true,
"noImplicitAny": false,
"downlevelIteration": true,
"esModuleInterop": true,
"module": "commonjs",
"target": "es5",
"lib": ["es2015", "es2017", "dom", "DOM.Iterable", "ESNext"],
"removeComments": true,
"allowSyntheticDefaultImports": true,
"jsx": "react",
"checkJs": false,
"strict": true,
"allowJs": true,
"types": ["node", "jest"]
},
"exclude": ["node_modules", "dist"],
"include": ["src/**/*"]
} |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Beta Was this translation helpful? Give feedback.
-
Seems like adding |
Beta Was this translation helpful? Give feedback.
Seems like adding
--ext js,mjs,json,ts
to the command helped as this directs nodemon process to handle files and the other--extensions \".ts,.tsx,. js\"
is handled bybabel-node
instead. It works anyway 👍