`

webpack 使用插件

阅读更多

内置插件

通过在配置中使用插件属性,可以将插件包含进你的模块中。

// webpack should be in the node_modules directory, install if not.
var webpack = require("webpack");

module.exports = {
    plugins: [
        new webpack.ResolverPlugin([
            new webpack.ResolverPlugin.DirectoryDescriptionFilePlugin("bower.json", ["main"])
        ], ["normal", "loader"])
    ]
};

 

其他插件

没有内建在webpack中的插件,如果发布在npm上的可以通过npm安装,其他的可以通过其他方式使用

npm install component-webpack-plugin

 通过以下方式使用

var ComponentPlugin = require("component-webpack-plugin");
module.exports = {
    plugins: [
        new ComponentPlugin()
    ]
}

 

 

0
1
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics