* Now Preact dev tools are injected into development bundles. * Updated frontend debugging documentation. * Updated frontend debugging documentation wording.
26 lines
871 B
JavaScript
26 lines
871 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/devtools 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/devtools', entryPointFileName];
|
|
} else {
|
|
previous[entryPointName] = entryPointFileName;
|
|
}
|
|
|
|
return previous;
|
|
},
|
|
{},
|
|
);
|
|
|
|
module.exports = config;
|