webpack-config-spaceship
Webpack config to get a project off the ground fast.
Installation
npm install --save-dev webpack-config-spaceship
Setup
// webpack.config.jsconst spaceship = ; moduleexports = ;
Options
cwd
Path to project root.
cwd: __dirname // recommended
context
Relative path to source directory. Affects entry paths. Relative to options.cwd
.
entry
Webpack entry.
main: './main/client/index.jsx'
https://webpack.js.org/configuration/entry-context/#entry
output.path
Relative path to output directory.
output: path: './build' // default
output.publicPath
https://webpack.js.org/guides/public-path
merge
Webpack config to be lodash.merge
d with the config generated by spaceship.
const config = ;
vendor
Boolean whether to automatically create a vendor chunk with babel-polyfill
and whatwg-fetch
. Turn this off for libraries.
common
Boolean whether to automatically create a common chunk. Turn this off for libraries.
filterPlugin(plugin, i)
A function to filter out plugins generated by spaceship.
const config = ;
mapPlugin(plugin, i)
A function to replace some plugins with different ones.
const config = ;
filterRule(rule, i)
Same as filterPlugin
, but for rules.
mapRule(rule, i)
Same as mapPlugin
, but for rules.
statsPath
Path to save webpack stats.
statsPath: 'src/webpack.stats.json' // default
manifestPath
Path to save manifest file (list of files by entry and type).
manifestPath: 'src/webpack.manifest.json' // default
stylesheets
Disable ExtractTextPlugin.
Hot Module Reloading
Spaceship automatically configures:
HotModuleReplacementPlugin
NamedModulesPlugin
react-hot-loader/babel
devServer
config option
What you'll need to configure:
- entry loaders
react-hot-loader/patch
webpack-dev-server/client?http://localhost:8080
,webpack/hot/only-dev-server
<AppContainer />
https://webpack.js.org/guides/hmr-react/
License
Copyright (c) 2017 Marius Craciunoiu. Licensed under the MIT license.