Skip to content

Commit 6d7f256

Browse files
it works, except on sandbox page
1 parent d68f5da commit 6d7f256

File tree

7 files changed

+93
-63
lines changed

7 files changed

+93
-63
lines changed

packages/app/config/babel.dev.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ module.exports = {
2828
require.resolve('@babel/preset-react'),
2929
].filter(Boolean),
3030
plugins: [
31+
require.resolve('react-hot-loader/babel'),
3132
require.resolve('@babel/plugin-transform-template-literals'),
3233
require.resolve('@babel/plugin-transform-destructuring'),
3334
require.resolve('@babel/plugin-proposal-object-rest-spread'),

packages/app/config/webpack.dev.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,15 @@ const merge = require('webpack-merge');
44
const WebpackBar = require('webpackbar');
55
const commonConfig = require('./webpack.common');
66

7-
const devEntries = [
8-
// 'react-hot-loader/patch',
9-
'webpack-dev-server/client?/',
10-
// 'webpack/hot/only-dev-server',
11-
];
7+
const devEntries = ['webpack-dev-server/client?/'];
128

139
module.exports = merge(
14-
// these go first, because "react-hot-loader/patch" has to be the first entry
1510
{
1611
entry: {
17-
app: devEntries,
12+
app: [
13+
'webpack-dev-server/client?http://localhost:3000',
14+
'webpack-hot-middleware/client',
15+
],
1816
embed: devEntries,
1917
},
2018
},
@@ -36,7 +34,7 @@ module.exports = merge(
3634
new webpack.EvalSourceMapDevToolPlugin({
3735
include: /src\/app/,
3836
}),
39-
// new webpack.HotModuleReplacementPlugin(),
37+
new webpack.HotModuleReplacementPlugin(),
4038
],
4139
}
4240
);

packages/app/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,10 @@
167167
"normalizr": "^3.2.3",
168168
"onigasm": "^2.2.1",
169169
"ot": "^0.0.15",
170-
"overmind": "^23.0.2-1583315924305",
170+
"overmind": "^23.1.0-1588056333188",
171171
"overmind-devtools": "^19.0.0",
172-
"overmind-graphql": "^3.1.0-1583324447920",
173-
"overmind-react": "^24.0.2-1583315924305",
172+
"overmind-graphql": "^3.1.0-1588056333188",
173+
"overmind-react": "^24.1.0-1588056333188",
174174
"phoenix": "^1.4.11",
175175
"postcss": "^7.0.26",
176176
"postcss-selector-parser": "^2.2.3",
@@ -325,7 +325,7 @@
325325
"preval.macro": "^1.0.1",
326326
"promise": "7.1.1",
327327
"raw-loader": "^0.5.1",
328-
"react-hot-loader": "^4.0.0-beta.13",
328+
"react-hot-loader": "^4.12.20",
329329
"react-test-renderer": "16",
330330
"recursive-readdir": "^2.2.1",
331331
"resolve-url-loader": "^3.1.0",

packages/app/scripts/start.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,12 +281,14 @@ function runDevServer(port, protocol, index) {
281281
// Enable HTTPS if the HTTPS environment variable is set to 'true'
282282
https: protocol === 'https',
283283
// contentBase: paths.staticPath,
284+
public: 'localhost:3000',
284285
host: process.env.LOCAL_SERVER ? 'localhost' : 'codesandbox.test',
285286
disableHostCheck: !process.env.LOCAL_SERVER,
286287
contentBase: false,
287288
clientLogLevel: 'warning',
288289
overlay: true,
289-
inline: false,
290+
inline: true,
291+
hot: true,
290292
liveReload: process.env['DISABLE_REFRESH'] ? false : true,
291293
});
292294

packages/app/src/app/index.js

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import 'react-hot-loader/patch';
12
import '@codesandbox/common/lib/global.css';
23
import 'normalize.css';
34

@@ -136,15 +137,15 @@ window.getState = path =>
136137
window.getSignal = path =>
137138
path.split('.').reduce((aggr, key) => aggr[key], overmind.actions);
138139

140+
const rootEl = document.getElementById('root');
141+
139142
overmind.initialized.then(() => {
140143
requirePolyfills().then(() => {
141144
if (isSafari) {
142145
// eslint-disable-next-line
143146
import('subworkers');
144147
}
145148

146-
const rootEl = document.getElementById('root');
147-
148149
const showNotification = (message, type) => {
149150
notificationState.addNotification({
150151
message,
@@ -194,3 +195,39 @@ overmind.initialized.then(() => {
194195
}
195196
});
196197
});
198+
199+
if (module.hot) {
200+
module.hot.accept(['./pages/index.tsx', './overmind'], () => {
201+
const newOvermind = createOvermind(config, {
202+
delimiter: ' ',
203+
devtools:
204+
(window.opener && window.opener !== window) ||
205+
!window.chrome ||
206+
location.search.includes('noDevtools')
207+
? false
208+
: 'localhost:3031',
209+
name:
210+
'CodeSandbox - ' +
211+
(navigator.userAgent.indexOf('Chrome/76') > 0 ? 'Chrome' : 'Canary'),
212+
logProxies: true,
213+
});
214+
render(
215+
<ApolloProvider client={client}>
216+
<ActualOvermindProvider value={newOvermind}>
217+
<OvermindProvider value={newOvermind}>
218+
<HooksProvider client={client}>
219+
<ThemeProvider theme={theme}>
220+
<DndProvider backend={HTML5Backend}>
221+
<Router history={history}>
222+
<App />
223+
</Router>
224+
</DndProvider>
225+
</ThemeProvider>
226+
</HooksProvider>
227+
</OvermindProvider>
228+
</ActualOvermindProvider>
229+
</ApolloProvider>,
230+
rootEl
231+
);
232+
});
233+
}

packages/app/src/app/pages/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ import { Redirect, Route, Switch, withRouter } from 'react-router-dom';
1212
import { ErrorBoundary } from './common/ErrorBoundary';
1313
import { Modals } from './common/Modals';
1414
import { Dashboard } from './Dashboard';
15-
import { Dashboard as NewDashboard } from './NewDashboard';
1615
import { DevAuthPage } from './DevAuth';
1716
import { Container, Content } from './elements';
17+
import { Dashboard as NewDashboard } from './NewDashboard';
1818
import { NewSandbox } from './NewSandbox';
1919
import { Sandbox } from './Sandbox';
2020

yarn.lock

Lines changed: 39 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -7485,15 +7485,10 @@ [email protected]:
74857485
"@types/node" "^10.5.1"
74867486
tslib "^1.9.3"
74877487

7488-
7489-
version "1.0.2-1583315924305"
7490-
resolved "https://registry.yarnpkg.com/betsy/-/betsy-1.0.2-1583315924305.tgz#9ffab090df9c4b1e276cf6b083822d7849ff0189"
7491-
integrity sha512-o3EUfs58Oz2S7tn54nbEE6t3kKwvv+F5VTDbjrIlXXGMewv1OOqwSRatFQG2nswwEDzxuEfcG7yQMiDZGIh+9g==
7492-
7493-
7494-
version "1.0.2-1583324447920"
7495-
resolved "https://registry.yarnpkg.com/betsy/-/betsy-1.0.2-1583324447920.tgz#f6453b9b64e675a3edaad3f88ee4cb40472da12c"
7496-
integrity sha512-bExFE9koVJGUpyroPCwoQ6muiykV0q2h68S92C0YVaXA9j7BZ2Kowlh6Lp4Rb+alY6Ehah1oTN9Ag/iX2WbHqw==
7488+
7489+
version "1.0.2-1588056333188"
7490+
resolved "https://registry.yarnpkg.com/betsy/-/betsy-1.0.2-1588056333188.tgz#b2f7ed8056717c05585307f949724bc68cbff251"
7491+
integrity sha512-6N8sejJqXkHrn4VOSze/w+YkZ3tPEzDVv3zs9fF3U+IwC0nkBpplmu5kDJLCwCTQ27pE2iYx9dxQDlbBQBRBMw==
74977492

74987493
better-assert@~1.0.0:
74997494
version "1.0.2"
@@ -22169,16 +22164,16 @@ overmind-devtools@^19.0.0:
2216922164
react-dom "16.8.1"
2217022165
ws "^5.2.1"
2217122166

22172-
overmind-graphql@^3.1.0-1583324447920:
22173-
version "3.1.0-1583324447920"
22174-
resolved "https://registry.yarnpkg.com/overmind-graphql/-/overmind-graphql-3.1.0-1583324447920.tgz#6f231752aed892d0adde959ce816ecfd831a6cc2"
22175-
integrity sha512-EEVyZ/uLEbjSdBHIpw37hpXzJ3DwnJTDSIF0c6dmRWq1vCT8O5GQkkcrrD3vEAqpflceBSfinV2TYYU4dC50xw==
22167+
overmind-graphql@^3.1.0-1588056333188:
22168+
version "3.1.0-1588056333188"
22169+
resolved "https://registry.yarnpkg.com/overmind-graphql/-/overmind-graphql-3.1.0-1588056333188.tgz#c7ce8c9b65454b084cc68aa684e561e2c6fa7c4c"
22170+
integrity sha512-azEKo2MINOJQMTBSuqG5Pb+z4r+ujlRIOnrImJHwgsn0DSfEeJoiBivKVCNGKsImQ6w76mU9ajVRVJUcbogYzg==
2217622171
dependencies:
2217722172
"@absinthe/socket" "^0.2.1"
2217822173
graphql "^14.5.8"
2217922174
graphql-request "^1.8.2"
2218022175
graphql-tag "^2.10.1"
22181-
overmind "23.0.2-1583324447920"
22176+
overmind "23.1.0-1588056333188"
2218222177
phoenix "^1.4.13"
2218322178

2218422179
@@ -22190,12 +22185,12 @@ [email protected]:
2219022185
overmind "18.0.1"
2219122186
tslib "^1.9.3"
2219222187

22193-
overmind-react@^24.0.2-1583315924305:
22194-
version "24.0.2-1583315924305"
22195-
resolved "https://registry.yarnpkg.com/overmind-react/-/overmind-react-24.0.2-1583315924305.tgz#7f0e7f76ff25a34cc02f61c29ae0597deb2a1b89"
22196-
integrity sha512-BwEPu5xSQt8wgRwLay0ilbWhqX9KjdA3MS7RbMqJUWDOWVPniMQMtj19iS+siliID5JbD3U6BeHuSF0H3A1CIw==
22188+
overmind-react@^24.1.0-1588056333188:
22189+
version "24.1.0-1588056333188"
22190+
resolved "https://registry.yarnpkg.com/overmind-react/-/overmind-react-24.1.0-1588056333188.tgz#14f01774019a971c69627737239e00d5e8d35157"
22191+
integrity sha512-FokVcmzhhlaEPl6jXQ0ncb4go9MpwYRHmVGqZadLz9XsIc7nzuHPPq9bEIwi8opQeYuifaZY80IGLNi2D15fgw==
2219722192
dependencies:
22198-
overmind "23.0.2-1583315924305"
22193+
overmind "23.1.0-1588056333188"
2219922194

2220022195
overmind-themes@next:
2220122196
version "1.0.2-1562145138120"
@@ -22215,24 +22210,14 @@ [email protected]:
2221522210
proxy-state-tree "4.4.0"
2221622211
tslib "^1.9.3"
2221722212

22218-
22219-
version "23.0.2-1583315924305"
22220-
resolved "https://registry.yarnpkg.com/overmind/-/overmind-23.0.2-1583315924305.tgz#69549603d2d8a41085e6cb53d999f140a97d2484"
22221-
integrity sha512-04lB+dGBkDo+9aSuJGsTfuwlPUKcwD5l9Wou41no6nccczH6pcPerKmzAXt1ltCUmdA5Ah4Ol7yY6yLdrGWZQA==
22222-
dependencies:
22223-
betsy "1.0.2-1583315924305"
22224-
is-plain-obj "^1.1.0"
22225-
proxy-state-tree "5.0.0-1583315924305"
22226-
tslib "^1.10.0"
22227-
22228-
[email protected], overmind@^23.0.2-1583315924305:
22229-
version "23.0.2-1583324447920"
22230-
resolved "https://registry.yarnpkg.com/overmind/-/overmind-23.0.2-1583324447920.tgz#d92734cc79c16a21df8492a630572757f3627cb3"
22231-
integrity sha512-prxEwgEuhYhN5L1XW/zMxBLvRxjQzzpeo+9ppS/cYCr0vAEbKms4pKn81/UeZuwTzDlxuCl7Tl/LU74QDzOF4w==
22213+
[email protected], overmind@^23.1.0-1588056333188:
22214+
version "23.1.0-1588056333188"
22215+
resolved "https://registry.yarnpkg.com/overmind/-/overmind-23.1.0-1588056333188.tgz#e8152fbdd452075b4045f1427ccb3f93b6f975d0"
22216+
integrity sha512-4VxyQvqevfANc0M7B2KgoWz3+UFiAxozx4leRktHSHojZtFyrtGe5F+Cy16Cdcp4gx5BLzY731k8gELHqCtH0w==
2223222217
dependencies:
22233-
betsy "1.0.2-1583324447920"
22218+
betsy "1.0.2-1588056333188"
2223422219
is-plain-obj "^1.1.0"
22235-
proxy-state-tree "5.0.0-1583324447920"
22220+
proxy-state-tree "5.0.1-1588056333188"
2223622221
tslib "^1.10.0"
2223722222

2223822223
ow@^0.15.0:
@@ -24548,17 +24533,10 @@ [email protected]:
2454824533
dependencies:
2454924534
is-plain-obj "^1.1.0"
2455024535

24551-
24552-
version "5.0.0-1583315924305"
24553-
resolved "https://registry.yarnpkg.com/proxy-state-tree/-/proxy-state-tree-5.0.0-1583315924305.tgz#b10471bba99628d87c8fdfeee41e79ee3ed29632"
24554-
integrity sha512-7GUM5npXLkWAILYpnJUg9hQwCuzHz+vuMXg8mEzQ8IWSyhwcZ/UjZqyPjrem2ljgU1H4GbA3zzsS9S551KOJtQ==
24555-
dependencies:
24556-
is-plain-obj "^1.1.0"
24557-
24558-
24559-
version "5.0.0-1583324447920"
24560-
resolved "https://registry.yarnpkg.com/proxy-state-tree/-/proxy-state-tree-5.0.0-1583324447920.tgz#2ee11d1f8159219138dbd9a71dab4e077fd11949"
24561-
integrity sha512-AR7LXER1+1kgzup/bOnwOtyj7TBOsdGaNtGecHgageSW+JSQe7/j+cnflZqiB4T95UAz7BHdDA0OcjCctd6eYw==
24536+
24537+
version "5.0.1-1588056333188"
24538+
resolved "https://registry.yarnpkg.com/proxy-state-tree/-/proxy-state-tree-5.0.1-1588056333188.tgz#f03631a8d3fda8a247bebd821741385174d664fa"
24539+
integrity sha512-p8xU4SjGTECwVJ3nAxMUPKn6JW0omiLxdTCURl2axlM3GoEfxFhDlr22P8l6LAqKgOH9oaUbKxkshBC3qEcI5A==
2456224540
dependencies:
2456324541
is-plain-obj "^1.1.0"
2456424542

@@ -25198,7 +25176,7 @@ react-hook-inview@^4.1.2:
2519825176
resolved "https://registry.yarnpkg.com/react-hook-inview/-/react-hook-inview-4.1.2.tgz#0d0ecdf6f2c0255842debe95f5567702fc2b4083"
2519925177
integrity sha512-+NO6NKSYWEtc2vAWfaJMoeBVqt9NbncPygoCrSPJGLxu/UpiPWnsybX2lOfqQMrwIAXkQmrGTx0hnnRFXUfuzw==
2520025178

25201-
react-hot-loader@^4.0.0-beta.13, react-hot-loader@^4.12.11:
25179+
react-hot-loader@^4.12.11:
2520225180
version "4.12.11"
2520325181
resolved "https://registry.yarnpkg.com/react-hot-loader/-/react-hot-loader-4.12.11.tgz#06bd618d0a7343c8afa4a31206844f651193bae5"
2520425182
integrity sha512-ySsg1hPwr/5dkZCJVp1nZRbwbpbEQ+3e2+bn/D681Wvr9+o+5bLKkTGq0TXskj8HgCS3ScysXddOng9Cg+JKzw==
@@ -25212,6 +25190,20 @@ react-hot-loader@^4.0.0-beta.13, react-hot-loader@^4.12.11:
2521225190
shallowequal "^1.1.0"
2521325191
source-map "^0.7.3"
2521425192

25193+
react-hot-loader@^4.12.20:
25194+
version "4.12.20"
25195+
resolved "https://registry.yarnpkg.com/react-hot-loader/-/react-hot-loader-4.12.20.tgz#c2c42362a7578e5c30357a5ff7afa680aa0bef8a"
25196+
integrity sha512-lPlv1HVizi0lsi+UFACBJaydtRYILWkfHAC/lyCs6ZlAxlOZRQIfYHDqiGaRvL/GF7zyti+Qn9XpnDAUvdFA4A==
25197+
dependencies:
25198+
fast-levenshtein "^2.0.6"
25199+
global "^4.3.0"
25200+
hoist-non-react-statics "^3.3.0"
25201+
loader-utils "^1.1.0"
25202+
prop-types "^15.6.1"
25203+
react-lifecycles-compat "^3.0.4"
25204+
shallowequal "^1.1.0"
25205+
source-map "^0.7.3"
25206+
2521525207
2521625208
version "2.0.0"
2521725209
resolved "https://registry.yarnpkg.com/react-hotkeys/-/react-hotkeys-2.0.0.tgz#a7719c7340cbba888b0e9184f806a9ec0ac2c53f"

0 commit comments

Comments
 (0)