TypeStrong / TypeStrong/ts-loader
Webpack 5 cache - typings not cached
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 3.5k
- Forks
- 439
- Avg merge
- 17h 17m
- Merged PRs (30d)
- 2
Description
Bug 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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the webpack.config.js filesystem cache settings, tsconfig.json, and the ts-loader integration. Run the described build, remove dist, and run it again to compare cached and uncached output. Done means the second build emits the same bundle.js and .d.ts files as the first.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, webpack
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100