0.0.5 • Published 8 years ago
npm-submodule-webpack-plugin v0.0.5
$ npm install --save-dev npm-submodule-webpack-pluginLet 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 distThen you need to add the following lines into your webpack.config.js:
var NpmSubmodulePlugin = require("npm-submodule-webpack-plugin"); plugins: [
new NpmSubmodulePlugin({
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: [
new NpmSubmodulePlugin({
module: 'myproject',
commands: [
'install',
'compile'
],
logger: my-logger-method
})
]Working with arguments:
plugins: [
new NpmSubmodulePlugin({
module: 'myproject',
commands: [
'install --save react'
]
})
]