Cut react devtools forwarding by webpack in production build
This commit is contained in:
@@ -2,8 +2,6 @@
|
||||
echo "prepare environment"
|
||||
# replace BASE_URL constant by REMARK_URL
|
||||
sed -i "s|https://demo.remark42.com|${REMARK_URL}|g" /srv/web/*.js
|
||||
# remove devtools attach helper. TODO: move to webpack loader
|
||||
sed -i "/REMOVE-START/,/REMOVE-END/d" /srv/web/iframe.html
|
||||
|
||||
if [ -d "/srv/var" ]; then
|
||||
chown -R app:app /srv/var 2>/dev/null
|
||||
|
||||
@@ -109,14 +109,16 @@
|
||||
<div id="remark42">
|
||||
<div class="preloader preloader_view_iframe"></div>
|
||||
</div>
|
||||
<% if (htmlWebpackPlugin.options.env === 'development') { %>
|
||||
<script>
|
||||
/* REMOVE-START */
|
||||
if (window.parent !== window) {
|
||||
try {
|
||||
window.__REACT_DEVTOOLS_GLOBAL_HOOK__ = window.parent.__REACT_DEVTOOLS_GLOBAL_HOOK__;
|
||||
} catch (e) {}
|
||||
}
|
||||
/* REMOVE-END */
|
||||
</script>
|
||||
<% } %>
|
||||
<script>
|
||||
var lastHeight = 0;
|
||||
setInterval(function() {
|
||||
if (document.body.offsetHeight !== lastHeight && document.body.offsetHeight > 10) {
|
||||
|
||||
@@ -168,6 +168,12 @@ module.exports = () => ({
|
||||
'process.env.REMARK_NODE': JSON.stringify(NODE_ID),
|
||||
'process.env.REMARK_URL': env === 'production' ? JSON.stringify(remarkUrl) : 'window.location.origin',
|
||||
}),
|
||||
new Html({
|
||||
template: path.resolve(__dirname, 'iframe.html'),
|
||||
filename: 'iframe.html',
|
||||
inject: false,
|
||||
env,
|
||||
}),
|
||||
new Html({
|
||||
template: path.resolve(__dirname, 'index.ejs'),
|
||||
inject: false,
|
||||
@@ -203,7 +209,7 @@ module.exports = () => ({
|
||||
openAnalyzer: false,
|
||||
}),
|
||||
]),
|
||||
new Copy(['./iframe.html', './deleteme.html', './markdown-help.html']),
|
||||
new Copy(['./deleteme.html', './markdown-help.html']),
|
||||
],
|
||||
watchOptions: {
|
||||
ignored: /(node_modules|\.vendor\.js$)/,
|
||||
|
||||
Reference in New Issue
Block a user