bundle-url-check-loader

1.0.3 • Public • Published

Example

npm i bundle-url-check-loader -D
yarn add bundle-url-check-loader -D
pnpm i bundle-url-check-loader -D

js

const checkAUrlList = [
    "http://schemas.microsoft.com/office/excel/2006/main",
    "http://schemas.openxmlformats.org/officeDocument/2006/custom-properties",
    "https://zhihu.com",
];

for (let i = 0; i < 3; i++) {
    var a = document.createElement("a");
    a.setAttribute("href", checkAUrlList[i]);
    a.innerHTML='123s4';
    document.getElementById("body").appendChild(a);
}

webpack.config.js

module.exports = {
    ...
    module: {
      rules: [
          {
              test: /\.js$/,
              use:[{
                loader:"bundle-url-check-loader",
                options:{
                  url:'https://www.baidu.com',
                  reg:[/^http[s]{0,1}:\/\/schemas\.\S*/]
                }
              }],
          },
      ],
    },
    ...
   
};

or

chainConfig

config.module.rule('bundle-url').test(/\.js$/).options({
      url:'https://www.baidu.com',
        reg:[/^http[s]{0,1}:\/\/schemas\.\S*/]
    })

Readme

Keywords

Package Sidebar

Install

npm i bundle-url-check-loader

Weekly Downloads

0

Version

1.0.3

License

ISC

Unpacked Size

4.92 kB

Total Files

3

Last publish

Collaborators

  • warrenlee19