I got into a stupor about how to even connect the cdn library in the webpack through the documentation, I realized that https://webpack.js.org/configuration/externals/ extends to install and the documentation describes only the js file and it’s not clear if bootstrap or materialize where There are css and js files prefixed with a prefix and the second point is the path for cdn to define for the abbreviation in webpack
const path = require('path'); module.exports = { entry: './src/header.js', output: { path: path.resolve(__dirname, 'public'), filename: 'bundle.js', }, module: { rules: [ { test: /\.jsx$/, loader: 'babel-loader', exclude: /\/node_module\// }, ] }, devtool: 'source-map', context: __dirname, watch: true, watchOptions: { aggregateTimeout: 300 } }; import templaet from 'header.pug'; class Header{ constructor(name, path, typeCDN){ this.name = name; this.path = path; this.type = typeCDN; } } let arr = []; /** Попробовал так */ let jquery = new Header('jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js', 'js'); let materializeCss = new Header('materialize-js', 'https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js', 'js'); let materializeJs = new Header('materialize-css', 'https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.min.css', 'css'); let icon = new Header('materialize-icon', 'https://fonts.googleapis.com/icon?family=Material+Icons', 'css'); arr.push(jquery, materializeCss, materializeJs, icon); console.log(arr); I just don’t understand how to connect all these settings or does it only affect the connection of components?
npmmodule for the required library, for example, the modulematerialize-css:npm install materialize-css. Then, in the main js file, we writeimport 'materialize-css'and the webpack, in theory, should itself collect all the css and js files and include them on the page at the right place - diraria