Skip to content

Webpack plugin that allows to configure dynamic chunk's src.

Notifications You must be signed in to change notification settings

daihere1993/webpack-dynamic-src

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

webpack-dynamic-src

Webpack plugin that allows to configure dynamic chunk's src.

Install

npm install webpack-dynamic-src

Usage

// webpack.config.js
const WebpackDynamicSrc = require('webpack-dynamic-src');

module.exports = {
  plugins: [
    new WebpackDynamicSrc({ fn: 'dynamicSrcFn' })
  ]
}

// main.js
window.dynamicSrcFn = function (oldSrc) {
  // do something by oldSrc;
  console.log(`Original src: ${oldSrc}`);
  let chunkName = oldSrc.slice(oldSrc.lastIndexOf('/') + 1);
  return `https://www.google.com/test/${chunkName}`;
}

About

Webpack plugin that allows to configure dynamic chunk's src.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published