my configuration file looks like this. The ides/shimming/-sharpshimming-%E5%85%A8%E5%B1%80%E5%8F%98%E9%87%8F" rel=" nofollow noreferrer > official guide provides ["lodash-es","chunk"]
as an array of parameter values, but why is the whole lodash
still packaged? What I expect is to package only the lodash
chunk
method. What"s going on?
-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp webpack.config.js -sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp
const path = require("path")
const CleanWebpackPlugin = require("clean-webpack-plugin")
const HtmlWebpackPlugin = require("html-webpack-plugin")
const webpack = require("webpack")
module.exports = {
mode:"production",
entry: "./src/index.js",
output: {
filename: "[name].bundle.js",
path: path.resolve(__dirname, "dist")
},
plugins: [
new CleanWebpackPlugin("dist"),
new HtmlWebpackPlugin({
filename:"index.html",
template:"index.html"
}),
new webpack.ProvidePlugin({
_chunk:["lodash-es","chunk"]
})
]
}
-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp index.js -sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp
console.log(_chunk(["a", "b", "c", "d", "e"], 2))
- look at the packaged
main
file, which obviously packages the wholelodash
, WTF?