It’s for a test run

preface

1 chainWebpack chain operation

The config. Plugins plugin

Use Plug-ins

// config.plugin(name)
// A named plug-in

HtmlWebpackPlugin is used by default
/ / do not need to use
config.plugin('html')

// Named plugin povide, using webpack.providePlugin
// Args must be array, options need to use array wrap
plugin('povide')
  .use(webpack.ProvidePlugin, [options])

Copy the code

Tap Change parameter

// htmlWebpackPlugin
config.plugin('html').tap(args= > {
  // Add CDN resources
  // Dynamically introduce link and script in index.htm
  args[0].CDN = CDNSources
  
  // You must return args
  return args
})

// ProvidePlugin
plugin('povide')
  .use(webpack.ProvidePlugin, [{
    _: 'lodash'
  }])
  .tap(args= > {
    console.log('povide', args)
    return args
  })
Copy the code

Use Plug-ins

// config.plugin(name)
// A named plug-in

HtmlWebpackPlugin is used by default
/ / do not need to use
config.plugin('html')

// Named plugin povide, using webpack.providePlugin
// Args must be array, options need to use array wrap
plugin('povide')
  .use(webpack.ProvidePlugin, [options])

Copy the code

Tap Change parameter

// htmlWebpackPlugin
config.plugin('html').tap(args= > {
  // Add CDN resources
  // Dynamically introduce link and script in index.htm
  args[0].CDN = CDNSources
  
  // You must return args
  return args
})

// ProvidePlugin
plugin('povide')
  .use(webpack.ProvidePlugin, [{
    _: 'lodash'
  }])
  .tap(args= > {
    console.log('povide', args)
    return args
  })
Copy the code

Use Plug-ins

// config.plugin(name)
// A named plug-in

HtmlWebpackPlugin is used by default
/ / do not need to use
config.plugin('html')

// Named plugin povide, using webpack.providePlugin
// Args must be array, options need to use array wrap
plugin('povide')
  .use(webpack.ProvidePlugin, [options])

Copy the code

Tap Change parameter

// htmlWebpackPlugin
config.plugin('html').tap(args= > {
  // Add CDN resources
  // Dynamically introduce link and script in index.htm
  args[0].CDN = CDNSources
  
  // You must return args
  return args
})

// ProvidePlugin
plugin('povide')
  .use(webpack.ProvidePlugin, [{
    _: 'lodash'
  }])
  .tap(args= > {
    console.log('povide', args)
    return args
  })
Copy the code

Use Plug-ins

// config.plugin(name)
// A named plug-in

HtmlWebpackPlugin is used by default
/ / do not need to use
config.plugin('html')

// Named plugin povide, using webpack.providePlugin
// Args must be array, options need to use array wrap
plugin('povide')
  .use(webpack.ProvidePlugin, [options])

Copy the code

Tap Change parameter

// htmlWebpackPlugin
config.plugin('html').tap(args= > {
  // Add CDN resources
  // Dynamically introduce link and script in index.htm
  args[0].CDN = CDNSources
  
  // You must return args
  return args
})

// ProvidePlugin
plugin('povide')
  .use(webpack.ProvidePlugin, [{
    _: 'lodash'
  }])
  .tap(args= > {
    console.log('povide', args)
    return args
  })
Copy the code

Use Plug-ins

// config.plugin(name)
// A named plug-in

HtmlWebpackPlugin is used by default
/ / do not need to use
config.plugin('html')

// Named plugin povide, using webpack.providePlugin
// Args must be array, options need to use array wrap
plugin('povide')
  .use(webpack.ProvidePlugin, [options])

Copy the code

Tap Change parameter

// htmlWebpackPlugin
config.plugin('html').tap(args= > {
  // Add CDN resources
  // Dynamically introduce link and script in index.htm
  args[0].CDN = CDNSources
  
  // You must return args
  return args
})

// ProvidePlugin
plugin('povide')
  .use(webpack.ProvidePlugin, [{
    _: 'lodash'
  }])
  .tap(args= > {
    console.log('povide', args)
    return args
  })
Copy the code

Use Plug-ins

// config.plugin(name)
// A named plug-in

HtmlWebpackPlugin is used by default
/ / do not need to use
config.plugin('html')

// Named plugin povide, using webpack.providePlugin
// Args must be array, options need to use array wrap
plugin('povide')
  .use(webpack.ProvidePlugin, [options])

Copy the code

Tap Change parameter

// htmlWebpackPlugin
config.plugin('html').tap(args= > {
  // Add CDN resources
  // Dynamically introduce link and script in index.htm
  args[0].CDN = CDNSources
  
  // You must return args
  return args
})

// ProvidePlugin
plugin('povide')
  .use(webpack.ProvidePlugin, [{
    _: 'lodash'
  }])
  .tap(args= > {
    console.log('povide', args)
    return args
  })
Copy the code