Describe what happened
Module not found: Error: Can't resolve '/Users/zzzzz/git/www/yyyyy/dist/webpack.1.__datadog-helper-file.js' - the datadogWebpackPlugin creates this file and depends on it
When webpack's build starts — and if output.clean: true is set (which is a standard practice), webpack wipes dist/ before building, deleting the helper file
Steps to reproduce the issue:
- set output.clean: true in webpack config
- set datadogWebpackPlugin
plugins: [
datadogWebpackPlugin({
rum: {
enable: true,
sourceCodeContext: {
service: config.module.name,
version: config.packageJsonVersion || '0.0.0',
},
},
})]
- run devServer
Expected behaviour:
datadog-helper-file.js isn't deleted when the app runs so the datadogWebpackPlugin works fine
Actual behaviour:
- Injection plugin's compiler function runs, creates the file at dist/webpack.1.__datadog-helper-file.js via
outputFileSync (xpack.ts:35)
- Entry points are modified to include this file path (xpack.ts:170-171)
- Webpack's build starts — and if output.clean: true is set, webpack wipes dist/ before building, deleting the helper file
- Webpack's resolver then tries to find the file and fails