1.0.0 • Published 3 years ago

babel-plugin-on-demand v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

为了配合 wqjiaoutils 简化按需加载文件/方法引入的路径实现的 babel 插件,该插件中主要还原了简化路径的实际路径,更新日志

Usage

npm install --save-dev babel-plugin-on-demand
yarn add babel-plugin-on-demand -D
  • .babelrc
// .babelrc
{
    "plugins": [
        [
            "on-demand",
            {
                "library": "wqjiaoutils"
            }
        ]
    ]
}

// webpack -> babel-loader
module: {
    rules: [{
        test: /\.js$/,
        loader: "babel-loader",
    }]
},
  • webpack config
module: {
    rules: [{
        test: /\.js$/,
        loader: "babel-loader",
        options: {
            plugins: [
                [
                    "on-demand",
                    {
                        "library": "wqjiaoutils"
                    }
                ],
            ]
        }
    }]
},

Reference

diana babel-plugin-on-demand-loading onDemandLoading