//webpack.config.js
module.exports = {
entry: {
index: "./index.js"
},
output: {
filename: "[name].js"
}
};
as shown above, the entry file is index.js
, and there are main.css
, logo.png
and other files in the same level directory of index.js
. Now you need to require
other files in index.js
and compile webpack
and finally package them into a file:
//index.js
require("main.css");
require("logo.png");
the above requirements are based on the premise that index.js
cannot be changed manually and new entry files are not generated. Can this function be dynamically implemented in the compilation of webpack
, such as using plugin
? Solution, thank you!