Skip to content

Commit

Permalink
fix: keep the logics only triggered in main compilation (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
licg9999 committed Dec 20, 2022
1 parent 0560e1b commit ac29459
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
6 changes: 1 addition & 5 deletions e2e/works-with-webpack-configs-in-popular-tools.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const webpackConfig = require('react-scripts/config/webpack.config')(envInQuesti
webpackConfig.entry = './src/server.js';
webpackConfig.plugins = webpackConfig.plugins.filter(
(p) => !['HtmlWebpackPlugin', 'WebpackManifestPlugin'].includes(p.constructor.name)
(p) => p.constructor.name !== 'WebpackManifestPlugin'
);
webpackConfig.plugins.push(new Plugin());
Expand Down Expand Up @@ -73,10 +73,6 @@ const webpackConfig = require('@vue/cli-service/webpack.config');
webpackConfig.entry = './src/server.js';
webpackConfig.plugins = webpackConfig.plugins.filter(
(p) => !['HtmlWebpackPlugin'].includes(p.constructor.name)
);
webpackConfig.plugins.push(new Plugin());
module.exports = webpackConfig;
Expand Down
3 changes: 3 additions & 0 deletions src/Plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ export class TranspileWebpackPlugin {
});

compiler.hooks.finishMake.tapPromise(pluginName, async (compilation) => {
// Only evaluates new entries in the main compilation.
if (compilation.compiler !== compiler) return;

const outputPath = compiler.options.output.path!;
const outputPathOfNodeModules = path.resolve(outputPath, baseNodeModules);
const context = compiler.options.context!;
Expand Down

0 comments on commit ac29459

Please sign in to comment.