webpack-hot-release
single page application hot release with webpack && git
webpack.config.js
- should use git
- should use history mode with spa router
const WebpackHotReleasePlugin = ; plugins: ;
browser
/** * first script **/ ;
hot-release.js
; ;
How it works?
- webpack produce release.json in dist folder, like this,it will always the newest relase file
- webpack.DefinePlugin() to Define GIT args
'process.env.GIT_COMMIT'
'process.env.GIT_BRANCH'
'process.env.GIT_MESSAGE'
'process.env.GIT_DATE'
-
in client browser,it overriade pushState && replaceState function,make a request to fetch 'release.json'
-
in production it will 'location.reload()',in development,just output message