Skip to content

Commit e647dee

Browse files
committed
Synchornize configuration with app-template-react
1 parent 60a9e76 commit e647dee

5 files changed

Lines changed: 40 additions & 15 deletions

File tree

package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,20 @@
3636
"start": "snowpack dev",
3737
"test": "jest"
3838
},
39+
"dependencies": {
40+
"react": "^17.0.1",
41+
"react-dom": "^17.0.1"
42+
},
3943
"devDependencies": {
4044
"@glennsl/bs-jest": "^0.6.0",
41-
"@snowpack/app-scripts-react": "^1.12.6",
45+
"@snowpack/plugin-dotenv": "^2.0.5",
46+
"@snowpack/plugin-react-refresh": "^2.3.9",
4247
"@snowpack/plugin-run-script": "^2.2.1",
43-
"@testing-library/jest-dom": "^5.11.5",
48+
"@testing-library/jest-dom": "^5.11.8",
4449
"@testing-library/react": "^11.1.1",
4550
"bs-platform": "^8.4.2",
4651
"bs-react-testing-library": "^0.8.0",
4752
"jest": "^26.6.3",
48-
"react": "^17.0.1",
49-
"react-dom": "^17.0.1",
5053
"reason-react": "^0.9.1",
5154
"snowpack": "^2.18.5"
5255
}

public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<body>
1111
<div id="root"></div>
1212
<noscript>You need to enable JavaScript to run this app.</noscript>
13-
<script type="module" src="/_dist_/index.bs.js"></script>
13+
<script type="module" src="/dist/index.bs.js"></script>
1414
<!--
1515
This HTML file is a template.
1616
If you open it directly in the browser, you will see an empty page.

snowpack.config.js

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,33 @@
1+
/** @type {import("snowpack").SnowpackUserConfig } */
12
module.exports = {
2-
extends: '@snowpack/app-scripts-react',
3+
mount: {
4+
public: {url: '/', static: true},
5+
src: {url: '/dist'},
6+
},
37
plugins: [
8+
'@snowpack/plugin-react-refresh',
9+
'@snowpack/plugin-dotenv',
410
[
511
'@snowpack/plugin-run-script',
612
{
713
cmd: 'bsb -make-world',
814
watch: '$1 -w',
915
},
10-
],
16+
]
1117
],
18+
install: [
19+
/* ... */
20+
],
21+
installOptions: {
22+
/* ... */
23+
},
24+
devOptions: {
25+
/* ... */
26+
},
27+
buildOptions: {
28+
/* ... */
29+
},
30+
alias: {
31+
/* ... */
32+
},
1233
};

src/App.res

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44

55
@react.component
66
let make = () => {
7-
let (count, setCount) = React.useState(() => 0)
7+
let (count, setCount) = React.useState(() => 0.)
88

99
React.useEffect0(() => {
10-
let intervalId = Js.Global.setInterval(() => setCount(count => count + 1), 1000)
10+
let intervalId = Js.Global.setInterval(() => setCount(count => count +. 1.), 100)
11+
1112
Some(() => Js.Global.clearInterval(intervalId))
1213
})
1314

@@ -21,8 +22,8 @@ let make = () => {
2122
</p>
2223
<p>
2324
{React.string("Page has been open for ")}
24-
<code> {React.int(count)} </code>
25-
{React.string(" seconds.")}
25+
<code> {React.string(Printf.sprintf("%.1f", count /. 10.))} </code>
26+
{React.string(" seconds")}
2627
</p>
2728
<a className="App-link" href="https://reactjs.org" target="_blank" rel="noopener noreferrer">
2829
{React.string("Learn React")}

src/index.res

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
%%raw(`import './index.css';`)
2-
3-
ReactDOMRe.renderToElementWithId(<App />, "root")
4-
51
// Hot Module Replacement (HMR) - Remove this snippet to remove HMR.
62
// Learn more: https://www.snowpack.dev/#hot-module-replacement
73
@scope(("import", "meta")) @val external hot: bool = "hot"
84

95
@scope(("import", "meta", "hot")) @val
106
external accept: unit => unit = "accept"
117

8+
%%raw(`import './index.css';`)
9+
10+
ReactDOMRe.renderToElementWithId(<React.StrictMode> <App /> </React.StrictMode>, "root")
11+
1212
if hot {
1313
accept()
1414
}

0 commit comments

Comments
 (0)