Skip to content

Commit

Permalink
Fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
lukastaegert committed Jun 16, 2021
1 parent c155a4d commit d8ad9ac
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/999-big-list-of-options.md
Expand Up @@ -1385,7 +1385,7 @@ Default: `true`

Whether to apply tree-shaking and to fine-tune the tree-shaking process. Setting this option to `false` will produce bigger bundles but may improve build performance. You may also choose one of three presets that will automatically be updated if new options are added:

* `"smallest"` will choose option values for you to minimize output size as much as possible. This should work for most code bases as long as certain as you do not rely on certain patterns, which are currently:
* `"smallest"` will choose option values for you to minimize output size as much as possible. This should work for most code bases as long as you do not rely on certain patterns, which are currently:
* getters with side effects will only be retained if the return value is used (`treeshake.propertyReadSideEffects: false`)
* code from imported modules will only be retained if at least one exported value is used (`treeshake.moduleSideEffects: false`)
* you should not bundle polyfills that rely on detecting broken builtins (`treeshake.tryCatchDeoptimization: false`)
Expand Down
2 changes: 1 addition & 1 deletion src/utils/options/mergeOptions.ts
Expand Up @@ -181,7 +181,7 @@ const objectifyTreeshakeOption = (value: unknown): Record<string, unknown> => {
if (typeof value === 'string') {
const preset = treeshakePresets[value as TreeshakingPreset];
if (preset) {
return (preset as unknown) as Record<string, unknown>;
return preset as unknown as Record<string, unknown>;
}
error(
errInvalidOption(
Expand Down
11 changes: 6 additions & 5 deletions src/utils/options/normalizeInputOptions.ts
Expand Up @@ -27,9 +27,10 @@ export interface CommandConfigObject {
globals: { [id: string]: string } | undefined;
}

export function normalizeInputOptions(
config: InputOptions
): { options: NormalizedInputOptions; unsetOptions: Set<string> } {
export function normalizeInputOptions(config: InputOptions): {
options: NormalizedInputOptions;
unsetOptions: Set<string>;
} {
// These are options that may trigger special warnings or behaviour later
// if the user did not select an explicit value
const unsetOptions = new Set<string>();
Expand All @@ -38,7 +39,7 @@ export function normalizeInputOptions(
const onwarn = getOnwarn(config);
const strictDeprecations = config.strictDeprecations || false;
const options: NormalizedInputOptions & InputOptions = {
acorn: (getAcorn(config) as unknown) as NormalizedInputOptions['acorn'],
acorn: getAcorn(config) as unknown as NormalizedInputOptions['acorn'],
acornInjectPlugins: getAcornInjectPlugins(config),
cache: getCache(config),
context,
Expand Down Expand Up @@ -102,7 +103,7 @@ const getAcornInjectPlugins = (
): NormalizedInputOptions['acornInjectPlugins'] => ensureArray(config.acornInjectPlugins);

const getCache = (config: InputOptions): NormalizedInputOptions['cache'] =>
((config.cache as unknown) as RollupBuild)?.cache || config.cache;
(config.cache as unknown as RollupBuild)?.cache || config.cache;

const getIdMatcher = <T extends Array<any>>(
option:
Expand Down

0 comments on commit d8ad9ac

Please sign in to comment.