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

Question [webpack-cli] TypeError: compiler.plugin is not a function #73

Closed
ThatAnonyG opened this issue Jan 18, 2021 · 4 comments
Closed

Comments

@ThatAnonyG
Copy link

When I add this plugin to my webpack.config.js for my ExpressJS app I get the following error stack.

[webpack-cli] TypeError: compiler.plugin is not a function
    at WebpackShellPlugin.apply (F:\Backend\node_modules\webpack-shell-plugin\lib\index.js:236:16)
    at createCompiler (F:\Backend\node_modules\webpack\lib\webpack.js:69:12)
    at create (F:\Backend\node_modules\webpack\lib\webpack.js:113:15)
    at webpack (F:\Backend\node_modules\webpack\lib\webpack.js:121:46)
    at f (F:\Backend\node_modules\webpack\lib\index.js:37:15)
    at WebpackCLI.createCompiler (F:\Backend\node_modules\webpack-cli\lib\webpack-cli.js:1165:24)
    at async WebpackCLI.bundleCommand (F:\Backend\node_modules\webpack-cli\lib\webpack-cli.js:1292:20)
    at async Command.<anonymous> (F:\Backend\node_modules\webpack-cli\lib\webpack-cli.js:322:21)
    at async Promise.all (index 1)
    at async Command.<anonymous> (F:\Backend\node_modules\webpack-cli\lib\webpack-cli.js:708:13)

Any idea why this is happening? When I remove the shell plugin code the error is gone too.

My webpack.config.js:

const { join, resolve } = require("path");
const ShellPlugin = require("webpack-shell-plugin");
const nodeExternals = require("webpack-node-externals");

module.exports = {
	entry: join(__dirname, "src", "index.ts"),
	target: "node",
	mode: process.env.NODE_ENV,
	output: {
		path: resolve(__dirname, "dist"),
		filename: "bundle.js",
	},
	watch: process.env.NODE_ENV === "development",
	resolve: {
		extensions: [".ts", ".js"],
	},
	externals: [nodeExternals()],
	module: {
		rules: [
			{
				test: /\.ts$/,
				exclude: /node_modules/,
				use: {
					loader: "ts-loader",
				},
			},
		],
	},
	plugins: [
		new ShellPlugin({
			onBuildEnd: ["npm run dev:start"],
		}),
	],
};
@cpuix
Copy link

cpuix commented Jan 27, 2021

Webpack does not support the usage methods of this package in new versions. You can actively look at this package.

https://www.npmjs.com/package/webpack-shell-plugin-next

@ThatAnonyG
Copy link
Author

Oh wow, I forgot about this. Thanks for the help. Will close this issue then.

@svk014
Copy link

svk014 commented Jun 30, 2021

@ThatAnonyG any updates on this?

@wilson0x4d
Copy link

@ThatAnonyG any updates on this?

project seems abandoned. use an alternative like webpack-shell-plugin-next

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

4 participants