Skip to content
This repository was archived by the owner on Aug 25, 2025. It is now read-only.

Commit d40367c

Browse files
authored
Merge pull request #157 from rustwasm/local-file-deps
Use local file dependencies instead of npm link
2 parents 44b348d + 3c333ad commit d40367c

File tree

1 file changed

+15
-18
lines changed

1 file changed

+15
-18
lines changed

src/game-of-life/hello-world.md

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -286,34 +286,31 @@ JavaScript bundler and its development server.
286286
> Note that `webpack` is not required for working with Rust and WebAssembly, it
287287
> is just the bundler and development server we've chosen for convenience
288288
> here. Parcel and Rollup should also support importing WebAssembly as
289-
> ECMAScript modules.
289+
> ECMAScript modules. You can also use Rust and WebAssembly [without a
290+
> bundler][] if you prefer!
291+
292+
[without a bundler]: https://rustwasm.github.io/docs/wasm-bindgen/examples/without-a-bundler.html
290293

291294
### Using our Local `wasm-game-of-life` Package in `www`
292295

293296
Rather than use the `hello-wasm-pack` package from npm, we want to use our local
294297
`wasm-game-of-life` package instead. This will allow us to incrementally develop
295298
our Game of Life program.
296299

297-
First, run `npm link` inside the `wasm-game-of-life/pkg` directory, so that the
298-
local package can be depended upon by other local packages without publishing
299-
them to npm:
300-
301-
```bash
302-
npm link
303-
```
304-
305-
> 🐞 Did you get `EACCESS` or permissions errors when running `npm link`? [How
306-
> to Prevent Permissions Errors with
307-
> `npm`.](https://docs.npmjs.com/getting-started/fixing-npm-permissions)
308-
309-
Second, use the `npm link`ed version of the `wasm-game-of-life` from the `www`
310-
package by running this command within `wasm-game-of-life/www`:
300+
Open up `wasm-game-of-life/www/package.json` and edit the `"dependencies"` to
301+
include a `"wasm-game-of-life": "file:../pkg"` entry:
311302

312-
```
313-
npm link wasm-game-of-life
303+
```js
304+
{
305+
// ...
306+
"dependencies": {
307+
"wasm-game-of-life": "file:../pkg", // Add this line!
308+
// ...
309+
}
310+
}
314311
```
315312

316-
Finally, modify `wasm-game-of-life/www/index.js` to import `wasm-game-of-life`
313+
Next, modify `wasm-game-of-life/www/index.js` to import `wasm-game-of-life`
317314
instead of the `hello-wasm-pack` package:
318315

319316
```js

0 commit comments

Comments
 (0)