Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Cannot read property 'tapPromise' of undefined #171

Open
tjx666 opened this issue Mar 9, 2020 · 9 comments
Open

[BUG] Cannot read property 'tapPromise' of undefined #171

tjx666 opened this issue Mar 9, 2020 · 9 comments

Comments

@tjx666
Copy link

tjx666 commented Mar 9, 2020

I find it conflicts with speed-measure-webpack-plugin:

screenshot_2020-03-09_14-50-55

When I remove speed-measure-webpack-plugin,no this error.

The project repository: coo;
webpack.dev.ts:

import { resolve } from 'path';
import merge from 'webpack-merge';
import { HotModuleReplacementPlugin, NamedModulesPlugin, DllReferencePlugin } from 'webpack';
import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
import AddAssetHtmlPlugin from 'add-asset-html-webpack-plugin';

import { PROJECT_ROOT } from '../constants';
import commonConfig from './webpack.common';

const devConfig = merge(commonConfig, {
    mode: 'development',
    devtool: 'eval-source-map',
    plugins: [
        new HotModuleReplacementPlugin(),
        new NamedModulesPlugin(),
        new ForkTsCheckerWebpackPlugin({
            memoryLimit: 1024,
            tsconfig: resolve(__dirname, '../../src/renderer/tsconfig.json'),
        }),
        new DllReferencePlugin({
            context: PROJECT_ROOT,
            manifest: resolve(PROJECT_ROOT, 'public/vendor/vendors-manifest.json'),
        }),
        new AddAssetHtmlPlugin({ filepath: resolve(PROJECT_ROOT, 'public/vendor/*.dll.js') }),
    ],
});

export default devConfig;

webpack.index.ts:

import { argv } from 'yargs';
import merge from 'webpack-merge';
import SpeedMeasurePlugin from 'speed-measure-webpack-plugin';
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
import SizePlugin from 'size-plugin';

import { __DEV__ } from '../constants';
import devConfig from './webpack.dev';
import prodConfig from './webpack.prod';

// eslint-disable-next-line import/no-mutable-exports
let webpackConfiguration = __DEV__ ? devConfig : prodConfig;
if (argv.analyze) {
    webpackConfiguration = merge(webpackConfiguration, {
        plugins: [new SizePlugin({ writeFile: false }), new BundleAnalyzerPlugin()],
    });
    const smp = new SpeedMeasurePlugin();
    webpackConfiguration = smp.wrap(webpackConfiguration);
}
export default webpackConfiguration;
@mayu888
Copy link

mayu888 commented May 16, 2020

me too

@Wangzongyao
Copy link

so how to fix it

@bsarun
Copy link

bsarun commented Nov 4, 2020

Any update on the above issue?

@zhangming27
Copy link

是插件更新了,

@zhouguanglong
Copy link

是插件更新了,

怎么解决呢?

@biluox
Copy link

biluox commented Dec 23, 2020

是插件更新了,

怎么解决呢?

卸载当前版本,装低版本,5的就可以了

@ltxhhz
Copy link

ltxhhz commented Dec 23, 2020

我是用compression-webpack-plugin的时候出现的这个问题,和楼主一样的报错
所以是这个插件的问题,卸载了
npm uninstall compression-webpack-plugin
装个低版本的,比如6.1.1
npm i compression-webpack-plugin@6.1.1 -D
当前的最新版本是7.1.1,经过我的测试7.x的两个版本都不行
来个大佬翻译一下?
poor English

@biruk-tesfaye
Copy link

biruk-tesfaye commented Dec 24, 2020

我是用compression-webpack-plugin的时候出现的这个问题,和楼主一样的报错
所以是这个插件的问题,卸载了
npm uninstall compression-webpack-plugin
装个低版本的,比如6.1.1
npm i compression-webpack-plugin@6.1.1 -D
当前的最新版本是7.1.1,经过我的测试7.x的两个版本都不行
来个大佬翻译一下?
poor English

This problem occurred when I was using compression-webpack-plugin, the same error as the original poster
So it's the problem with this plugin, uninstall it
npm uninstall compression-webpack-plugin
Install a lower version, such as 6.1.1
npm i compression-webpack-plugin@6.1.1 -D
The current latest version is 7.1.1. After my test, the two versions of 7.x are not working
Can someone translate it? .... (Google did not me :))

@XuShunyi
Copy link

XuShunyi commented Apr 9, 2024

locate error at:
image
debug source at:
image
result:
variable beforeGenerationHook was not assigned (undeined), so the error was throw out.
solution:
update the html-webpack-plugin bigger than version4.0.0.
happy coding~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants