Skip to content

Commit 3b34dfd

Browse files
committed
refactor: provide better default options
1 parent 3f254f4 commit 3b34dfd

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -333,11 +333,11 @@ Options passed to the [AssemblyScript compiler](https://www.assemblyscript.org/c
333333

334334
| Name | Type | Description |
335335
|------------------|----------| ----------- |
336-
| `debug` | boolean | Enables debug information in emitted binaries. |
337-
| `optimizeLevel` | number | How much to focus on optimizing code. [0-3] |
338-
| `shrinkLevel` | number | How much to focus on shrinking code size. [0-2] |
336+
| `debug` | boolean | Enables debug information in emitted binaries, enabled by default in webpack development mode. |
337+
| `optimizeLevel` | number | How much to focus on optimizing code, 3 by default. [0-3] |
338+
| `shrinkLevel` | number | How much to focus on shrinking code size, 1 by default. [0-2] |
339339
| `coverage` | boolean | Re-optimizes until no further improvements can be made. |
340-
| `noAssert` | boolean | Replaces assertions with just their value without trapping. |
340+
| `noAssert` | boolean | Replaces assertions with just their value without trapping, enabled by default in webpack production mode. |
341341
| `importMemory` | boolean | Imports the memory provided as 'env.memory'. |
342342
| `noExportMemory` | boolean | Does not export the memory as 'memory'. |
343343
| `initialMemory` | number | Sets the initial memory size in pages. |

src/loader/index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ function loader(this: any, buffer: Buffer) {
4949
runtime: module.type?.startsWith("webassembly") ? "stub" : "incremental",
5050
exportRuntime: !module.type?.startsWith("webassembly"),
5151
debug: this.mode === "development",
52+
optimizeLevel: 3,
53+
shrinkLevel: 1,
54+
noAssert: this.mode === "production",
5255
// user options
5356
...userAscOptions,
5457
};

0 commit comments

Comments
 (0)