vpack v1.1.23
vpack
Dev tool for running Webpack dev server and builds at vigour.io.
install it
npm i -g vpack or npm i --save vpack
commands
run
default command (vpack or vpack run): Starts a webpack-dev-server on the current directory.
options
./path/to/entry.jsentry point (defaults to./index.js)-p--portport to run dev-server (defaults to a randon port)-o--openopen the server in the default browser (http://localhost:${port}/webpack-dev-server/index.html)-c ./path/to/webpack.config.js--configpath to specific webpack config file (this will be merged with the default values onvpackconfig. Check custom-config section for more info about what is merged)--packageincludesDefinePluginexposingpackage.jsonas an object onglobal.VIGOUR_CONFIG--template ./path/to/template.htmlpath to template html in which all bundles and css will be inject when running in browser (defaults to./template.html)--no-common-pluginremoves webpack.optimize.CommonsChunkPlugin that is inserted by default--ignore-babelremoves default loader forjs--public-pathchanges the default/public path. You can set it tofalseso it's considered as empty''public path.--devtool-ddevtool to be used for source maps. Defaults tocheap-module-source-map. More info here
bundle|build
vpack bundle vpack build run webpack and generates the bundle in the output path folder. This options removes all configuration related to webpack-dev-server and hot module replacement.
options
./path/to/entry.jsentry point (defaults to./index.js)--output|--output-path ./path/path to where bundled files will be stored (defaults tobuild)--template ./path/to/template.htmlpath to template html in which all bundles and css will be inject when running in browser (defaults to./template.html)--hashesinclude hashes in all generated bundle files (css and js) for long term caching. This is already injected in the bundle reference inindex.html.--ignore-babelremoves default loader forjs--no-common-pluginremoveswebpack.optimize.CommonsChunkPluginthat is inserted by default--public-pathchanges the default/public path. You can set it tofalseso it's considered as empty''public path.-p--productionadd plugins for performance, uglify, etc.- plugins added:
webpack.optimize.UglifyJsPluginwebpack.optimize.OccurenceOrderPluginwebpack.optimize.DedupePlugin
custom-config
-c ./path/to/webpack.config.js allows you to override some default configuration files. If you want to specify the entry point, for example, you can create your config with the following content:
module.exports = {
entry: './custom_entry.js'
}override/include loaders
it will merge loaders based on the test property (must be a string, e.g.: test: /\.less$/).
If it can't find this test loader, it will be included as a new one.
module.exports = {
module: {
loaders: [
{
test: /\.scss$/,
loaders: ['style', 'css?sourceMap', 'sass?sourceMap']
}
]
},
plugins: [
new ExtractTextPlugin('[hash].bundle.css', {
allChunks: true
})
]
}add plugins
var AwesomePlugin = require('awesome-plugin')
module.exports = {
plugins: [
new AwesomePlugin()
]
}default-settings
devtool: 'cheap-module-source-map'(merges with the custom webpack config file)entryan array of entries wich merges with the custom webpack config file. By default it includeswebpack/hot/dev-serverandwebpack-dev-server/client?http://localhost:${port}/(Hotis enabled by default)module.loadersare also merged. The default loaders arelessandbabelwithes2015preset
loaders
You can specify custom loaders in the webpack config file. They will be merged. Below, the list of current default module loaders.
test: /\.less$/,
loader: 'style!css!less?strictMath'test: /\.js$/,
loader: 'babel',
query: {
presets: [
require.resolve('babel-preset-es2015')
]
}10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago