-
Notifications
You must be signed in to change notification settings - Fork 62
Closed
Description
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"],
}),
],
};Metadata
Metadata
Assignees
Labels
No labels