Webpack dev tools to make performance analysis, error investigation and loader development more convenient. Provide the following functions:
- All modules and intermediate compilation results passed by the loaders.
- The time consuming of all loaders and the number of files they compile.
- Module dependency graph structure visualization.(Think of performance, the function will be closed when the number of modules is greater than 100)
- View the final config of webpack.
pnpm install @modern-js/inspector-webpack-plugin -D
// webpack.config.ts
import { InspectorWebpackPlugin } from '@modern-js/inspector-webpack-plugin'
// Add plugin
export default {
plugins: [new InspectorWebpackPlugin()]
}
export default {
plugins: [new InspectorWebpackPlugin({
// Custom the port of devtool page, which is 3333 by default.
port: 3456,
// Config the module that need to be ignored, ignore will not work by default.
ignorePattern: /node_modules/
})]
}
The UI interface implementation of inspector is modified from existing project vite-plugin-inspect
.At the same time, webpack loader in the inspect got inspired by speed-measure-webpack-plugin
.Thanks for them.