0

My project structure is like this

.
└── my-app/
    ├── .configs/
    │   ├── tsconfig.json
    │   ├── webpack.merge.ts
    │   ├── webpack.dev.config.ts
    │   └── webpack.prod.config.ts
    ├── node_modules
    ├── src/
    │   └── index.tsx
    └── package.json

I am have installed ts-node and webpack-dev-server. When I run npm start I get typescript errors because I suspect ts-node is linting the webpack configuration:

error TS7006: Parameter 'env' implicitly has an 'any' type.

How can I configure the webpack-dev-server settings to use the configuration file .configs/tsconfig.json when running ts-node? I there an option that I am missing in the "start" command that can be passed down to ts-node?

package.json

...
"start": "webpack serve --config ./.configs/.webpack.merge.ts --mode=development",
...

webpack.merge.ts

import webpackMerge from 'webpack-merge';
import devConfig from './webpack.dev.config';
import prodConfig from './webpack.prod.config';


export default (env, arg) => {
  const envConfig = arg.mode === 'production'
    ? prodConfig
    : devConfig;

  return webpackMerge({}, envConfig);
};
M.Holmes
  • 403
  • 1
  • 7
  • 22

1 Answers1

0

This answer goes on the heels of Can I set a typescript configuration `tsconfig.json` path on the VSCode IDE to use?

If you follow the solution posted there then ts-node will read the tsconfig.json at the root.

M.Holmes
  • 403
  • 1
  • 7
  • 22