Skip to content

Commit 8bcb871

Browse files
authored
Merge pull request #66 from oklas/docs-migration-to-options
docs: migration to options
2 parents 65dabd7 + 1a5dd30 commit 8bcb871

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

docs/migration.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
+ const {aliasWebpack} = require('react-app-alias')
1919
```
2020

21+
If dangerous mode is not used, scroll dow through next section to continue.
22+
2123
### Dangerous mode
2224

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

46+
### Options
47+
48+
Before the agrument of `aliasWebpack()` and `aliasJest()` was alias map.
49+
Now the argument of these functions is options.
50+
Alias map now is `alias` option. So replace:
51+
52+
```diff
53+
const aliasMap = configPaths("./tsconfig.paths.json")
54+
// or possible alias map created in code
55+
const aliasMap = {
56+
'@app': 'src/app',
57+
'@lib': 'lib',
58+
}
59+
60+
- module.exports = aliasWebpack(aliasMap)
61+
- module.exports.jest = aliasJest(aliasMap)
62+
+ module.exports = aliasWebpack({alias: aliasMap})
63+
+ module.exports.jest = aliasJest({alias: aliasMap})
64+
```
65+
66+
Fucntion `configPaths()` now become needed in rare cases. It is used internally.
67+
Now you can specify path of *tsconfig.json* or *jsconfig.json* as an option.
68+
69+
```diff
70+
- const aliasMap = configPaths("./tsconfig.paths.json")
71+
- module.exports = aliasWebpack({alias: aliasMap})
72+
+ module.exports = aliasWebpack({tsconfig: "./tsconfig.paths.json"})
73+
```
74+
75+
If you uses standart name of these files you can skip it. It will be opned automatically.
76+
77+
```diff
78+
- const aliasMap = configPaths("./jsconfig.paths.json")
79+
- module.exports = aliasWebpack({jsconfig: "./jsconfig.paths.json"})
80+
+ module.exports = aliasWebpack({})
81+
```
4482

0 commit comments

Comments
 (0)