Webpack 5 cache - typings not cached
See original GitHub issueBug report
What is the current behavior? d.ts files are not emitted after removing the output folder and running webpack again. I use ts-loader and have set declaration: true and outDir: ‘dist’ in tsconfig.json.
If the current behavior is a bug, please provide the steps to reproduce.
Run webpack build for the first time - bundle.js and typings are emitted. Remove ‘dist’ folder and run webpack again.
webpack.config.js:
{
mode: isDevelopment ? 'development' : 'production',
entry: {
main: ['./src/index.tsx'],
},
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist'),
publicPath: '/',
},
cache: {
type: 'filesystem',
buildDependencies: {
sources: [path.resolve(process.cwd(), 'src') + '/'],
tsConfig: [path.resolve(process.cwd(), 'tsconfig.json')],
config: [__filename]
},
},
module: {
rules: [
{
test: /\.tsx?$/,
include: path.join(__dirname, 'src'),
use: {
loader: 'ts-loader'
}
},
{
test: /\.jsx?$/,
include: path.join(__dirname, 'src'),
use: 'babel-loader',
},
],
},
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx'],
},
};
What is the expected behavior? I expect idempotent behavior - set of files emitted by webpack build is the same regardless if the cache is utilized or not.
Other relevant information: webpack version: 5.37.1 Node.js version: 14.15.4 Operating System: Ubuntu 20.04 Additional tools: ts-loader: 9.2.2, typescript: 4.0.3
This issue was moved from webpack/webpack#13465 by @alexander-akait. Original issue was by @MBelniak.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:10 (3 by maintainers)
Reopened - if anyone would like to work on it that’s great. I’m not planning to myself, so we’ll need someone to step up if they want this to progress
If you’d like to look at this I’d be happy to look at the PR!