When webpack DllPlugin is utilized alongside bootstrap 4 beta, it leads to an Uncaught ReferenceError

Currently, I am utilizing DllPlugin in my development environment. However, once I introduce bootstrap into the build, it causes my vendor dll to break. Interestingly, if I comment out bootstrap, all other references work perfectly fine. Below is the relevant section from my configuration files.

Specifically for the vendor build:

    entry: {
        vendor: [
            'bootstrap',
            'event-source-polyfill',
            'font-awesome/css/font-awesome.css',
            'ionicons/dist/css/ionicons.css',
            'isomorphic-fetch',
            'jquery',
        ],
    },            
    output: {
        path: path.join(__dirname, 'assets'),                
        filename: '[name].js',
        library: '[name]_[hash]',
    },
    plugins: [
        new CleanWebpackPlugin('assets'),
        extractCss,
        new webpack.ProvidePlugin({
            $: 'jquery',
            jQuery: 'jquery',
            'window.jQuery': 'jquery',
            Popper: ['popper.js', 'default'],
        }),
        new webpack.DllPlugin({
            path: path.join(__dirname, 'assets', '[name]-manifest.json'),
            name: '[name]_[hash]',
        }),
    ],

Additionally, in the runtime config, I simply reference the link as follows:

    new webpack.DllReferencePlugin({
        context: __dirname,
        manifest: require('./assets/vendor-manifest.json'),
    }),

The manifest output appears like this:

{"name":"vendor_c0cb30d4f33754762565","content":{"./node_modules/event-source-polyfill/src/eventsource.js":{"id":5,"meta":{}},"./node_modules/font-awesome/css/font-awesome.css":{"id":6,"meta":{}},"./node_modules/ionicons/dist/css/ionicons.css":{"id":7,"meta":{}},"./node_modules/isomorphic-fetch/fetch-npm-browserify.js":{"id":8,"meta":{}},"./node_modules/jquery/dist/jquery.js":{"id":0,"meta":{}},"./node_modules/whatwg-fetch/fetch.js":{"id":9,"meta":{}},"./node_modules/bootstrap/dist/js/bootstrap.js":{"id":2,"meta":{}},"./node_modules/popper.js/dist/esm/popper.js":{"id":3,"meta":{"harmonyModule":true},"exports":["default"]},"./node_modules/webpack/buildin/global.js":{"id":4,"meta":{}}}}

Finally, the error message generated reads:

..\external "vendor_c0cb30d4f33754762565":1 Uncaught ReferenceError: vendor_c0cb30d4f33754762565 is not defined
    at Object.dll-reference vendor_c0cb30d4f33754762565 (..\external "vendor_c0cb30d4f33754762565":1)
    at __webpack_require__ (bootstrap ab071247d46d1a97c83e:678)
    at fn (bootstrap ab071247d46d1a97c83e:88)
    at Object../node_modules/webpack/buildin/global.js (global.js from dll-reference vendor_c0cb30d4f33754762565:1)
    at __webpack_require__ (bootstrap ab071247d46d1a97c83e:678)
    at fn (bootstrap ab071247d46d1a97c83e:88)
    at Object../node_modules/punycode/punycode.js (punycode.js:533)
    at __webpack_require__ (bootstrap ab071247d46d1a97c83e:678)
    at fn (bootstrap ab071247d46d1a97c83e:88)
    at Object../node_modules/url/url.js (url.js:24)

I'm relatively new to working with DllPlugin, but the setup seems straightforward enough. Any guidance or insights would be greatly appreciated. Thank you.

Answer №1

Configure the output.library option in the DLL bundling settings

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

Make real-time edits to JavaScript code on a webpage

Is there a method aside from using Firebug in the DOM view to edit live JavaScript embedded within an HTML page? For example, code like this within a .html file: <script type="text/javascript> // code here </script> Thank you. ...

Triggering unexpected syntax error upon clicking the dropdown menu in the navigation bar

I encountered an error when attempting to click the dropdown list on my website. The error message reads as follows: Uncaught Syntax error, unrecognized expression: #. This error only seems to occur when using Chrome or Edge browsers. Currently, I am usi ...

The issue arises when each child within a list lacks a distinct key property

Hello, I am encountering a minor issue. I would like to create a product details page where all the information about the product is displayed. This can be done by clicking on the product link. However, I am facing the following error: "Each child in a lis ...

What is the best way to extract information from a dynamically generated bootstrap form with changing fields and names?

In my MERN app, I have implemented a Bootstrap form where users can input various martial arts styles such as judo and bjj. React-tag-component is used to manage these styles. As users enter their preferred style, it gets added to an array named selected. ...

AngularUI Select2 ajax: ng-model not being updated with selection changes

After upgrading a solution from Angular 1.2.0rc1 to Angular 1.2.5, there seems to be an issue with the Select2 ajax functionality for a dropdown that we are using in conjunction with AngularUI. Prior to the update, everything was functioning correctly - S ...

What is the process for obtaining the MAC Address in a React Native Expo project?

***Whenever I attempt to retrieve the MAC address using expo-NETWORK, it prompts me for *** "handling promises" code : ` const ipAlert = async () => { try { const macAddress = await Network.getMacAddressAsync('wlan0')() } catch (e ...

How to use jquery and ajax to retrieve an array of data and show it on the screen

I am facing an issue with my ajax request. Actually, I am unsure of how to fetch multiple records. I attempted the following: $rqt = "SELECT a,b,c from table"; $res = mysql_query($rqt); while ($data = mysql_fetch_assoc($res)): $objet = $d ...

Separate a string into an array containing pairs of numbers

I'm currently working on splitting a hexadecimal string into an array of paired numbers. Here is the code snippet I have so far: function getRGB(hexVal) { var substrHexVal = hexVal.substring(1,hexVal.length); var splitHexVal = substrHexVal. ...

Ensuring that touch events are activated on Firefox's desktop browser

Testing on a Windows 7 desktop with touch capabilities, I performed a simple test that looked something like this: temp_div.addEventListener('touchstart', function(e){ /*confirm */ }, false) temp_div.addEventListener('pointerdown', fun ...

Uncovering the jsPlumb link between a pair of identifiers

Could someone help me understand how to disconnect two HTML elements that are connected? I have the IDs of both elements, but I'm not sure how to locate their connection in the jsPlumb instance. Any tips on finding the connection between two IDs? ...

Unexpected behavior with async pipe - variable becomes undefined upon reassignment

In my development process, I have implemented 2 components. One is responsible for fetching data from an external service, while the other one displays this data. The constructor of the first component is structured as follows: constructor( private dev ...

Include new items in the li tag using JavaScript

Hello, I am looking to dynamically add elements to an LI element when a link is clicked. I have successfully added elements to a DIV using the following code snippet: I came across a similar question on Which "href" value should I use for JavaScript links ...

Ways to dynamically generate a card using NuxtJS

I'm just starting out with NuxtJS and I'm curious about how to generate a v-card within a v-dialog box. Imagine this scenario: I have an "add" button that triggers a v-dialog, where I can input information into a form. After submitting the form, ...

I need help with customizing the progress bar in HTML and CSS

How can I create a progress bar like the one shown below: https://i.sstatic.net/BFv87.png .detail-load { height: 42px; border: 1px solid #A2B2C5; padding: 1px; border-radius: 10px; } .detail-load > .detail-loading { ...

`How to prevent other events from triggering in jQuery while an animation is running`

Writing again to seek help with a script issue on my webpage. I previously posted about a problem with the menu focus a week or two ago on this forum. A user suggested a helpful script, but unfortunately, it has a bug that I can't seem to fix. I' ...

Exploring ways to retrieve variables from nested arrays in PHP

I'm facing an issue with sending data from my javascript to a php server. It seems that I am unable to access all the variables that are being sent, especially when dealing with nested arrays and JSON strings. Below is the code snippet: sender.js $ ...

Trouble with the function to dynamically add and delete table rows

Currently utilizing Wordpress with WPMVC for my projects. In the process of dynamically adding table rows to a form in order to insert a new record into the table. Snippet of the code: views/admin/edit.php <h2>Edit Geozone</h2> <?php ec ...

Click to close the dropdown menu

I am working on a problem where I want the dropdown to close when clicking anywhere in the document, instead of just closing when clicking on the dropdown menu itself. Below is a snippet of the HTML and JQuery code that I currently have: HTML: <div cl ...

Exporting a module from a JavaScript file

I'm currently working on creating a React component that consists of just a simple function. import React from "react"; function TableSortFunction(data, method, column) { const newList = []; for (let i=0; i<data.length; i++) { ne ...

Tips for building a live React app!

I'm looking to develop a real-time news application that displays a list of countries with the latest news next to each country name, automatically updating as new information is added to the API. For instance, I have an endpoint like this: (for Aust ...