Skip to content

Commit

Permalink
Merge pull request #66 from oklas/docs-migration-to-options
Browse files Browse the repository at this point in the history
docs: migration to options
oklas authored Mar 8, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents 65dabd7 + 1a5dd30 commit 8bcb871
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions docs/migration.md
Original file line number Diff line number Diff line change
@@ -18,6 +18,8 @@
+ const {aliasWebpack} = require('react-app-alias')
```

If dangerous mode is not used, scroll dow through next section to continue.

### Dangerous mode

Dangerous mode is renamed to extended/extremal and the implementation
@@ -41,4 +43,40 @@ is moved to separated liblrary with suffix **`-ex`**.
+ const {aliasWebpack} = require('react-app-alias-ex')
```

### Options

Before the agrument of `aliasWebpack()` and `aliasJest()` was alias map.
Now the argument of these functions is options.
Alias map now is `alias` option. So replace:

```diff
const aliasMap = configPaths("./tsconfig.paths.json")
// or possible alias map created in code
const aliasMap = {
'@app': 'src/app',
'@lib': 'lib',
}

- module.exports = aliasWebpack(aliasMap)
- module.exports.jest = aliasJest(aliasMap)
+ module.exports = aliasWebpack({alias: aliasMap})
+ module.exports.jest = aliasJest({alias: aliasMap})
```

Fucntion `configPaths()` now become needed in rare cases. It is used internally.
Now you can specify path of *tsconfig.json* or *jsconfig.json* as an option.

```diff
- const aliasMap = configPaths("./tsconfig.paths.json")
- module.exports = aliasWebpack({alias: aliasMap})
+ module.exports = aliasWebpack({tsconfig: "./tsconfig.paths.json"})
```

If you uses standart name of these files you can skip it. It will be opned automatically.

```diff
- const aliasMap = configPaths("./jsconfig.paths.json")
- module.exports = aliasWebpack({jsconfig: "./jsconfig.paths.json"})
+ module.exports = aliasWebpack({})
```

0 comments on commit 8bcb871

Please sign in to comment.