You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(config): set new defaults for transformAliasedImportPaths
this commit updates the default values for the
`transformAliasedImportPaths` and
`transformAliasedImportPathsInCollection` configuration fields. both are
being updated to be set to `true` if neither a `true` nor `false` value
is provided (previously `false` if `false` or nothing was provided).
the latter of the two is used to set the former for, hence its new
default.
by setting both of these new defaults to `true`, the hope is that
stencil configuration will be simplified for projects using `paths` in
their `tsconfig.json`
STENCIL-829
BREAKING CHANGE: `transformAliasedImportPaths` and `transformAliasedPathsInCollection` both default to `true`. To opt-out of these new defaults, both may be set to `false` in `stencil.config.ts`. See https://stenciljs.com/docs/introduction/upgrading-to-stencil-four#transformaliasedimportpaths and https://stenciljs.com/docs/introduction/upgrading-to-stencil-four#transformaliasedimportpathsincollection (respectively) for more information
-[In Browser Compilation Support Removed](#in-browser-compilation-support-removed)
16
19
-[Legacy Context and Connect APIs Removed](#legacy-context-and-connect-APIs-removed)
17
20
-[Legacy Browser Support Removed](#legacy-browser-support-removed)
18
21
-[Drop Node 14 Support](#drop-node-14-support)
19
22
20
23
### General
21
24
25
+
#### New Configuration Defaults
26
+
Starting with Stencil v4.0.0, the default configuration values have changed for a few configuration options.
27
+
The following sections lay out the configuration options that have changed, their new default values, and ways to opt-out of the new behavior (if applicable).
28
+
29
+
##### `transformAliasedImportPaths`
30
+
31
+
TypeScript projects have the ability to specify a path aliases via the [`paths` configuration in their `tsconfig.json`](https://www.typescriptlang.org/docs/handbook/module-resolution.html#path-mapping) like so:
32
+
```json title="tsconfig.json"
33
+
{
34
+
"compilerOptions": {
35
+
"baseUrl": ".",
36
+
"paths": {
37
+
"@utils": ["src/utils/index.ts"]
38
+
}
39
+
}
40
+
}
41
+
```
42
+
In the example above, `"@utils"` would be mapped to the string `"src/utils/index.ts"` when TypeScript performs type resolution.
43
+
The TypeScript compiler does not however, transform these paths from their keys to their values as a part of its output.
44
+
Instead, it relies on a bundler/loader to do the transformation.
45
+
46
+
The ability to transform path aliases was introduced in [Stencil v3.1.0](https://github.com/ionic-team/stencil/releases/tag/v3.1.0) as an opt-in feature.
47
+
Previously, users had to explicitly enable this functionality in their `stencil.config.ts` file with `transformAliasedImportPaths`:
48
+
```ts title="stencil.config.ts - enabling 'transformAliasedImportPaths' in Stencil v3.1.0"
49
+
import { Config } from'@stencil/core';
50
+
51
+
exportconst config:Config= {
52
+
transformAliasedImportPaths: true,
53
+
// ...
54
+
};
55
+
```
56
+
57
+
Starting with Stencil v4.0.0, this feature is enabled by default.
58
+
Projects that had previously enabled this functionality that are migrating from Stencil v3.1.0+ may safely remove the flag from their Stencil configuration file(s).
59
+
60
+
For users that run into issues with this new default, we encourage you to file a [new issue on the Stencil GitHub repo](https://github.com/ionic-team/stencil/issues/new?assignees=&labels=&projects=&template=bug_report.yml&title=bug%3A+).
61
+
As a workaround, this flag can be set to `false` to disable the default functionality.
62
+
```ts title="stencil.config.ts - disabling 'transformAliasedImportPaths' in Stencil v4.0.0"
63
+
import { Config } from'@stencil/core';
64
+
65
+
exportconst config:Config= {
66
+
transformAliasedImportPaths: false,
67
+
// ...
68
+
};
69
+
```
70
+
71
+
For more information on this flag, please see the [configuration documentation](https://stenciljs.com/docs/config#transformaliasedimportpaths)
72
+
73
+
##### `transformAliasedImportPathsInCollection`
74
+
75
+
Introduced in [Stencil v2.18.0](https://github.com/ionic-team/stencil/releases/tag/v2.18.0), `transformAliasedImportPathsInCollection` is a configuration flag on the [`dist` output target](https://stenciljs.com/docs/distribution#transformaliasedimportpathsincollection).
76
+
`transformAliasedImportPathsInCollection` transforms import paths, similar to [`transformAliasedImportPaths`](#transformaliasedimportpathsincollection).
77
+
This flag however, only enables the functionality of `transformAliasedImportPaths` for collection output targets.
78
+
79
+
Starting with Stencil v4.0.0, this flag is enabled by default.
80
+
Projects that had previously enabled this functionality that are migrating from Stencil v2.18.0+ may safely remove the flag from their Stencil configuration file(s).
81
+
82
+
For users that run into issues with this new default, we encourage you to file a [new issue on the Stencil GitHub repo](https://github.com/ionic-team/stencil/issues/new?assignees=&labels=&projects=&template=bug_report.yml&title=bug%3A+).
83
+
As a workaround, this flag can be set to `false` to disable the default functionality.
84
+
```ts title="stencil.config.ts - disabling 'transformAliasedImportPathsInCollection' in Stencil v4.0.0"
85
+
import { Config } from'@stencil/core';
86
+
87
+
exportconst config:Config= {
88
+
outputTargets: [
89
+
{
90
+
type: 'dist',
91
+
transformAliasedImportPathsInCollection: false,
92
+
},
93
+
// ...
94
+
]
95
+
// ...
96
+
};
97
+
```
98
+
99
+
For more information on this flag, please see the [`dist` output target's documentation](https://stenciljs.com/docs/distribution#transformaliasedimportpathsincollection).
100
+
22
101
#### In Browser Compilation Support Removed
23
102
24
103
Prior to Stencil v4.0.0, components could be compiled from TSX to JS in the browser.
0 commit comments