A warning has been issued: CommonsChunkPlugin will now only accept one argument

  • I am currently working on building my Angular application using webpack.
  • To help me with this process, I found a useful link here.
  • In order to configure webpack, I created a webpack.config.js file at the package.json level and added the line "bundle": "webpack" in the package.json script section.
  • However, when attempting to run npm run bundle, I encountered an error message stating 'Failed at the [email protected] bundle script 'webpack'.
  • Can anyone provide assistance on how to rectify this issue?
  • Below, you will find the code snippet along with the error details for reference.

Folder Structure:

- webapp
  - app
    - app.module.ts
  - package.json
  - webpack.config.js

app.module.ts:

(Code snippet provided)

package.json:

(Code snippet provided)

webpack.config.js:

(Code snippet provided)

Error Details:

(Error message and stack trace provided)

Answer №1

Update the following code in your webpack.config.js:

new webpack.optimize.CommonsChunkPlugin(
    /* chunkName= */"vendor", /* filename= */"vendor.bundle.js")

to:

new webpack.optimize.CommonsChunkPlugin(
    {name:"vendor", filename:"vendor.bundle.js",})

After making this change, everything should work seamlessly.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Iterate over a collection of JSON objects and dynamically populate a table with statistical data

In JavaScript, I am trying to dynamically generate a table with statistical data from an API that contains an array of JSON objects. The JSON data has a property called "score" which is interpreted as follows: score: 5 (excellent); score: 4 (very good); ...

The instance of my ObjectType is coming back as an empty entity

Having trouble making relationships between two object types in my code. One of them is working fine, but the other one returns an empty object and I can't seem to find the issue. The first one works as expected and logs the rank type without any pro ...

Adapting JavaScript functions from IE to work on Firefox and Chrome: A comprehensive guide

I have encountered an issue with a function that retrieves the selected text range within a contenteditable div. While it works perfectly fine in Internet Explorer, it doesn't seem to work in Firefox and Chrome. Could someone kindly provide guidance ...

Top method for developing a Wizard element within React

As I delved into learning React, my focus shifted towards creating a Wizard component. My initial vision was to use it in this way: <Wizard isVisible={this.state.isWizardVisible}> <Page1 /> <Page2 /> </Wizard> However, I e ...

An error occurred when trying to set a cookie using Set-Cookie in a react application

Currently, I am immersed in a small project that involves user authentication via email and password before gaining access to their individual profiles. The backend operates on cookies which are established once the correct email and password combination i ...

Issues with voice state updates in JavaScript

I am currently working on setting up a discord bot to send notifications when someone joins a voice chat. While coding in Atom, I encountered the following error: TypeError: Cannot read property 'send' of undefined at Client.client.on (C:\U ...

Having difficulty choosing an element with protractor's virtual repeat functionality

Initially, I successfully used ng-repeat to select an element. However, the developers have since implemented virtual repeat which has caused the following code to stop working: expect(stores.listStores(0).getText()).toContain('Prahran'); expect ...

Problem with ng-repeat and custom directive in the header row

I'm currently in the process of transitioning our thead generation to a directive. However, I've noticed that when using this directive, the headers lose their styling and become clustered on the left side. Can anyone provide some assistance on w ...

Overlapping background images of flex elements in Safari

This webpage is designed as a single-page layout using Gatsby: <div className='mainContent'> <section className='contentSection'> <h1 className='header'>Heading</h1> <div c ...

calling object functions using additional parentheses

After reviewing the passport.js documentation, I came across this piece of code: app.get('/login', function(req, res, next) { passport.authenticate('local', function(err, user, info) { if (err) { return next(err); } if (!u ...

Tips for preventing "script info" from appearing before the actual output when running npm script my-script

When I execute the command below: $ npm run test There is some information about the test script: > <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="5d3024703032392831381d6c736d73">[email protected]</a> test ...

Determining the presence of generic K within generic M in Typescript Generics and Redux

Hello there I am currently working on minimizing repetitive code in my react application by utilizing Redux state. After choosing the Redux structure to use (refer to Context), I now aim to make it more concise. To achieve this, I have developed a generic ...

Include a CSS loader in the next.config.js file

Currently I have this next.config.js: const withCSS = require('@zeit/next-css') const withLess = require('@zeit/next-less') const withSass = require('@zeit/next-sass') if (typeof require !== 'undefined') { require ...

What is the method for showcasing background images sequentially?

css code #intro { position: relative; background-attachment: fixed; background-repeat: no-repeat; background-position: center top; -webkit-background-size: cover; -moz-background-size: cover; backgr ...

How can jQuery determine the amount of line breaks within a div element?

My div wrap size is a percentage of the screen width, containing multiple .item divs that break into new lines as the window size decreases. I attempted to calculate the total number of boxes that could fit based on their widths compared to the container ...

What is the counterpart of $.isEmptyObject({}) in Typescript for checking if an object is

Is there a formal method for testing an Object (response from server) to see if it is empty? Currently, I am using jQuery to accomplish this. this.http.post(url, data, {headers: headers}).then( result => { if (!$.isEmptyObject(result ...

I am facing an issue where my GitLab CI multi-runner is unable to recognize the npm command

Currently, I am utilizing the resources available at https://github.com/sameersbn/docker-gitlab-ci-multi-runner and deploying it using docker compose. The issue that I am facing is that my tasks are getting stuck due to an error stating that npm command i ...

Is Selenium suitable for testing single page JavaScript applications?

As a newcomer to UI testing, I'm wondering if Selenium is capable of handling UI testing for single-page JavaScript applications. These apps involve async AJAX/Web Socket requests and have already been tested on the service end points, but now I need ...

Swap out the image for a div element if the image is not found

Is there a way to accurately display an image if it's available, and use a div as a replacement if the image is not present? // How can I determine `imageExists` without encountering cross-origin issues? (imageExists) ? (<img class="avatar-img" sr ...

obtain information from a Java servlet on a web page

I am working on a webpage that displays various coordinates (longitude, latitude), and I need to create a Java class to sort these coordinates. My plan is to send the coordinates to a Java servlet before displaying them on the webpage. The servlet will th ...