Install
$ npm install --save-dev npm-submodule-webpack-plugin
Usage
Let say that you have something similar in your package.json
:
"dependencies": "myproject": "git+https://my.private/repo.git#1234567"
And you would like to run the following npm commands in the node_modules/myproject
folder:
$ npm run compile$ npm run dist
Then you need to add the following lines into your webpack.config.js
:
var NpmSubmodulePlugin = ;
plugins: module: 'myproject' autoInstall: true commands: 'compile' 'dist'
The autoInstall
field allows the plugin to run npm install
if the node_modules
folder is not exists. This is a boolean
field, and false
by default.
By default, the plugins use the console.log
method to log the output of the command, but it is possible, to use a custom logger:
plugins: module: 'myproject' commands: 'install' 'compile' logger: my-logger-method
Working with arguments:
plugins: module: 'myproject' commands: 'install --save react'