Coder Social home page Coder Social logo

fe-study's Introduction

fe study

修改第三方模块的 bug

通过 webpack 配置引入路径的别名来映射到自己改 bug 后的文件地址

  • 第一种方式
module.exports = {
    chainWebpack: (config) => {
        // lodash/_apply 是引入node_modules中文件的路径 我们通过alias映射到了我们自己的_apply.js文件
        config.resolve.alias.set('lodash/_apply', path.resolve(__dirname, 'src/assets/_apply.js'));
    },
};
  • 第二种方式 通过 patch-package 包修改
  1. 安装 patch-package
  2. 修改 package.json,新增命令 postinstall
  3. 修改 node_modules 里面的代码
  4. 执行命令 npx patch-package 包名

会生成一个 patches 的文件夹 里面有修改过的文件的 diff 记录

fe-study's People

Contributors

handsomepear avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.