-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add frontend live / hot reload workflow
The frontend workflow requires launching webpack in watch mode. This is then followed by manually copying the built bundles to the output directory of the site, or terminating and then relaunching the MarkBind command. With a frontend entry point setup in the core-web package, and the MarkBind /vue-strap fork merged into the main monorepo, let's take advantage of this and add a live / hot reload workflow. This provides a near instant edit-feedback development cycle that makes frontend development much quicker. This is integrated into the markbind serve command using the --dev option.
- Loading branch information
Showing
9 changed files
with
139 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,44 @@ | ||
const path = require('path'); | ||
const webpack = require('webpack'); | ||
const { merge } = require('webpack-merge'); | ||
|
||
const webpackDevMiddleware = require('webpack-dev-middleware'); | ||
const webpackHotMiddleware = require('webpack-hot-middleware'); | ||
const VueLoaderPlugin = require('vue-loader/lib/plugin'); | ||
|
||
const config = require('./webpack.common.js'); | ||
|
||
module.exports = merge(config, { | ||
mode: 'development', | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.css$/, | ||
use: [ | ||
'vue-style-loader', | ||
'css-loader', | ||
], | ||
}, | ||
module.exports = (publicPath) => { | ||
const webpackDevConfig = merge(config, { | ||
mode: 'development', | ||
entry: { | ||
markbind: ['webpack-hot-middleware/client', path.join(__dirname, 'src', 'index.js')], | ||
}, | ||
output: { | ||
publicPath, | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.css$/, | ||
use: [ | ||
'vue-style-loader', | ||
'css-loader', | ||
], | ||
}, | ||
], | ||
}, | ||
plugins: [ | ||
new webpack.HotModuleReplacementPlugin(), | ||
new webpack.NoEmitOnErrorsPlugin(), | ||
new VueLoaderPlugin(), | ||
], | ||
}, | ||
plugins: [new VueLoaderPlugin()], | ||
}); | ||
}); | ||
|
||
const compiler = webpack(webpackDevConfig); | ||
return [ | ||
webpackDevMiddleware(compiler, { | ||
publicPath, | ||
}), | ||
webpackHotMiddleware(compiler), | ||
]; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters