We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
merge
At first I thought it was a normal object data, when i use push method, I found that I was wrong.
object
push
for example:
const path = require('path') const merge = require('webpack-merge') const HtmlWebpackPlugin = require('html-webpack-plugin'); const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin const conf1 = { entry: { page1: 'src/page1', page2: 'src/page2' }, output: { path: path.resolve(__dirname, 'dist'), publicPath: '/' } } const conf2 = { entry: { page3: 'src/page3', page4: 'src/page4' }, output: { path: path.resolve(__dirname, 'dist'), publicPath: '/' } } const enhance = { plugins: [ new BundleAnalyzerPlugin({ analyzerMode: 'server', }) ] } const result1 = merge(conf1, enhance) const result2 = merge(conf2, enhance) console.log(result1.plugins.length) console.log(result2.plugins.length)
the result is:
When I use the push method to add HtmlWebpackPlugin,the result has change.
HtmlWebpackPlugin
const path = require('path') const merge = require('webpack-merge') const HtmlWebpackPlugin = require('html-webpack-plugin'); const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin const conf1 = { entry: { page1: 'src/page1', page2: 'src/page2' }, output: { path: path.resolve(__dirname, 'dist'), publicPath: '/' } } const conf2 = { entry: { page3: 'src/page3', page4: 'src/page4' }, output: { path: path.resolve(__dirname, 'dist'), publicPath: '/' } } const enhance = { plugins: [ new BundleAnalyzerPlugin({ analyzerMode: 'server', }) ] } const result1 = merge(conf1, enhance) const result2 = merge(conf2, enhance) result1.plugins.push( new HtmlWebpackPlugin() ) console.log(result1.plugins.length) console.log(result2.plugins.length)
I have not operated another, but the plugins is changed.
when i use merge method, the result is correct.
const path = require('path') const merge = require('webpack-merge') const HtmlWebpackPlugin = require('html-webpack-plugin'); const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin const conf1 = { entry: { page1: 'src/page1', page2: 'src/page2' }, output: { path: path.resolve(__dirname, 'dist'), publicPath: '/' } } const conf2 = { entry: { page3: 'src/page3', page4: 'src/page4' }, output: { path: path.resolve(__dirname, 'dist'), publicPath: '/' } } const enhance = { plugins: [ new BundleAnalyzerPlugin({ analyzerMode: 'server', }) ] } let result1 = merge(conf1, enhance) const result2 = merge(conf2, enhance) result1 = merge(result1, { plugins: [ new HtmlWebpackPlugin() ] }) console.log(result1.plugins.length) console.log(result2.plugins.length)
why?
The text was updated successfully, but these errors were encountered:
559292d
Thanks for the report. Resolved in 4.2.1. Sorry for the delay. Super busy year with work.
4.2.1
Sorry, something went wrong.
No branches or pull requests
At first I thought it was a normal
object
data, when i usepush
method, I found that I was wrong.for example:
the result is:
When I use the
push
method to addHtmlWebpackPlugin
,the result has change.I have not operated another, but the plugins is changed.
when i use
merge
method, the result is correct.why?
The text was updated successfully, but these errors were encountered: