docbrown/config/webpack/development.js
Suzanne Aitchison dcecc8bf00
Log prop-types warnings to console in development (#14635)
* enable debug for warnings in dev env

* remove preact/devtools call no longer needed

* fix majority of proptype errors on home page

* sweep up proptype errors from listings page

* fix article form error
2021-09-01 09:27:58 +01:00

27 lines
866 B
JavaScript

/* eslint-env node */
process.env.NODE_ENV = process.env.NODE_ENV || 'development';
const environment = require('./environment');
const config = environment.toWebpackConfig();
// For more information, see https://webpack.js.org/configuration/devtool/#devtool
config.devtool = 'eval-source-map';
// Inject the preact/debug import into all the webpacker pack files (webpack entry points) that reference at least one Preact component
// so that Preact compoonents can be debugged with the Preact DevTools.
config.entry = Object.entries(config.entry).reduce(
(previous, [entryPointName, entryPointFileName]) => {
if (/\.jsx$/.test(entryPointFileName)) {
previous[entryPointName] = ['preact/debug', entryPointFileName];
} else {
previous[entryPointName] = entryPointFileName;
}
return previous;
},
{},
);
module.exports = config;