You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pages/docs/manual/latest/build-overview.mdx
+16-22Lines changed: 16 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,43 +11,37 @@ ReScript comes with a build system, bsb, that's meant to be fast, lean and used
11
11
12
12
The build description file is called `bsconfig.json`. Every ReScript project needs one.
13
13
14
-
**To build a project**, run:
14
+
## Build Project
15
+
16
+
Each build will create build artifacts from your project's source files.
17
+
18
+
**To build a project (including its dependencies / pinned-dependencies)**, run:
15
19
16
20
```sh
17
21
bsb -make-world
18
22
```
19
23
20
24
Add `-w` to keep the built-in watcher running. Any new file change will be picked up and the build will re-run.
21
25
22
-
**Note**: third-party libraries (in `node_modules`) aren't watched, as doing so may exceed the node.js watcher count limit. If you're doing quick and dirty modifications inside `node_modules`, you have to do `bsb -clean-world -make-world` to rebuild them.
23
-
24
-
**Note 3**: If you are developing across multiple devices, you may find the `-ws` configuration useful in order to have live-reloading across the network. Possible configurations are:
25
-
-`bsb -make-world -w -ws _` (default)
26
-
-`bsb -make-world -w -ws 0.0.0.0:9999`
27
-
-`bsb -make-world -w -ws 5000`
26
+
**Note**: third-party libraries (in `node_modules`, or via `pinned-dependencies`) aren't watched, as doing so may exceed the node.js watcher count limit.
28
27
29
-
**To build only yourself**, use `bsb`.
28
+
**Note 2**: In case you want to set up a project in a JS-monorepo-esque approach (`yarn workspaces` / `lerna`) where changes in your sub packages should be noticed by the compiler (`bsb -make-world`), you will need to define pinned dependencies in your main project's `bsconfig.json`. More details [here](./build-pinned-dependencies).
30
29
31
-
`bsb -help` to see all the available options.
30
+
**To build only your project's files (without dependencies)**, run:
32
31
33
-
## Artifacts Cleaning
34
-
35
-
If you ever get into a stable build for edge-case reasons, use:
36
32
37
33
```sh
38
-
bsb -clean-world
34
+
bsb
39
35
```
40
36
41
-
Or `bsb -clean` to clean only your own artifacts.
37
+
## Clean Project
42
38
43
-
## Editor Support
39
+
If you ever get into a stale build for edge-case reasons, use:
44
40
45
-
Bsb generates a `.merlin` file, used by various [editor plugins](editor-plugins.md) under the hood to power e.g. autocomplete, type hint, diagnosis, etc.
46
-
47
-
### Tips & Tricks
48
-
49
-
A typical problem with traditional build systems is that they're not resilient against the user moving/deleting source files. Most don't clean up the old artifacts correctly after such user action\*. Bsb is unfortunately no different, **unless** you turn on `"suffix": ".bs.js"` in `bsconfig.json`, in which case we can track which JS artifact belongs to which source file correctly, even against source file moving/deletion.
41
+
```sh
42
+
bsb -clean-world
43
+
```
50
44
51
-
## Design Decisions
45
+
This will clean all your project's build artifacts, including those in your dependencies. Alternatively you can run `bsb -clean` to clean your project's build artifacts only.
52
46
53
-
\* One such build system that tracks these correctly & efficiently is [Tup](http://gittup.org/tup/). See the (rather accessible!) paper [here](http://gittup.org/tup/build_system_rules_and_algorithms.pdf). Unfortunately, Tup's implementation uses FUSE and other systems, which we can't safely use on every platform.
47
+
For more infos, run `bsb -help` to see all the available options.
Copy file name to clipboardExpand all lines: pages/docs/manual/latest/build-pinned-dependencies.mdx
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ Usually we'd recommend to use ReScript in a single-codebase style: One `bsconfig
14
14
There are scenarios where you still want to connect and build multiple independent ReScript packages for one main project though. This is where `pinned-dependencies` come into play.
15
15
16
16
17
-
###Package Types
17
+
## Package Types
18
18
19
19
Before we go into detail, let's first explain all the different package types recognized by the build system:
20
20
@@ -24,7 +24,7 @@ Before we go into detail, let's first explain all the different package types re
24
24
25
25
Whenever a package is being built (`bsb -make-world`), the build system will build the toplevel package with its pinned-dependencies. So any changes made in a pinned dependency will automatically be reflected in the final app.
26
26
27
-
###Build System Package Rules
27
+
## Build System Package Rules
28
28
29
29
The build system respects the following rules for each package type:
0 commit comments