Webpack4 configuration Public JS and CSS are not packaged, only do separate compression

there are common.js and env.js, as well as base.scss coming in through require. There is also a Jquery
clipboard.png

HtmlWebpackPlugin

clipboard.png

1.common.jsenv.jsJSbase.scsscss
2.JSJquery

clipboard.png

3. Is there any way to package public files separately, Jquery and common,env separately, and base

Mar.12,2021

first of all, the configuration you posted is not to extract jquery at all, but to extract all js files and type them into packages called jquery .

cacheGroups: {
    common: {
      // 
      test: path.resolve(__dirname, '../src/assets/js/common'),
      name: "commmon-test",
      chunks: "all",
      enforce: true
    }
}
Packages under node_modules can be configured in this way. By the same token, if your jquery is installed through npm , I can't try to extract it. The style file is the same, but there is a problem with the style file. Although webpack everything is a module, the style file is still logically extracted from js , generating base.css at the same time, there will be an extra base.js file (basically empty).

is also the answer that has been answered under another answer. Packages like jquery can be introduced directly into html, using cdn (or other paths). In webpack, you can solve the introduction by configuring externals .


is a direct separation of js files
here is a webpack4 example, you can check https://github.com/crlang/eas..


vendor configuration item for js separate package
css separate package extract-text-webpack-plugin

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e9b0e5-475e5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e9b0e5-475e5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?