Skip to content

moxun1639/dynamic-replace-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dynamic-replace-loader

webpack dynamic-replace-loader

Note

Only replace within a single file, Please make sure that the content to be replaced is not accessed by other files

Getting Started

install

npm install --save-dev dynamic-replace-loader

webpack.config.js

module.exports = {
  module: {
    rules: [
      {
        test: /\.js$/,
        loader: 'dynamic-replace-loader',
      },
    ],
  },
};

Example

/* DYNAMIC-REPLACE _propA */
class User {
  constructor() {
    this._propA = 'private context'
  }

  printPropA() {
    console.log(this._propA)
  }
}

The code output by load: ('_propA' was replaced by random characters 'MX')

/* DYNAMIC-REPLACE _propA */
class User {
  constructor() {
    this.MX = 'private context'
  }

  printPropA() {
    console.log(this.MX)
  }
}

About

webpack dynamic-replace-loader

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published