Skip to content

Commit 8a841c8

Browse files
authored
docs(README): add more sample
1 parent 70ec20e commit 8a841c8

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

README.md

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ ArrayBuffer loader for webpack
1111
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fpine%2Farraybuffer-loader.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fpine%2Farraybuffer-loader?ref=badge_shield)
1212

1313

14+
## Supported Platforms
15+
16+
- Modern Browsers (IE >= 10)
17+
- Node.js
18+
1419
## Getting Started
1520

1621

@@ -25,16 +30,28 @@ $ npm install arraybuffer-loader --save-dev
2530
```
2631

2732
## Usage
28-
29-
See offical document [Loaders](https://webpack.js.org/concepts/loaders/).
33+
If you read only the specific extensions (e.g. wasm), please add loader in `webpack.config.js`.
3034

3135
```js
32-
var buffer = require('arraybuffer!./data.dat')
33-
var array = new Uint8Array(buffer)
36+
module: {
37+
loaders: [
38+
{
39+
test: /\.wasm$/,
40+
loaders: ['arraybuffer-loader'],
41+
},
42+
],
43+
},
44+
```
3445

35-
// Enjoy!!
46+
Or if reading an arbitrary extension, use `require`.
47+
48+
```js
49+
const buffer = require('arraybuffer!./data.dat')
50+
const array = new Uint8Array(buffer)
3651
```
3752

53+
See also offical document [Loaders](https://webpack.js.org/concepts/loaders/).
54+
3855
## License
3956
MIT © Pine Mizune
4057

0 commit comments

Comments
 (0)