@astryxdesign/build 0.2.0 → 0.3.0-canary.2d2dba1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/config.js +13 -1
package/package.json
CHANGED
package/src/config.js
CHANGED
|
@@ -58,7 +58,19 @@ function stylexOptions(rootDir, overrides = {}) {
|
|
|
58
58
|
*/
|
|
59
59
|
function babel(rootDir, overrides = {}) {
|
|
60
60
|
return {
|
|
61
|
-
presets: [
|
|
61
|
+
presets: [
|
|
62
|
+
// Enable `allowDeclareFields` on the TypeScript preset. Next's
|
|
63
|
+
// `next/babel` preset does not set this by default, so any raw `.ts`
|
|
64
|
+
// that uses `declare` class fields (a TS 3.7+ construct) fails to
|
|
65
|
+
// compile. Astryx source builds resolve dependencies via the `source`
|
|
66
|
+
// export condition, so a `source`-shipping dependency imported from an
|
|
67
|
+
// Astryx package (e.g. `lexical`/`@lexical/*`, pulled in by the lab
|
|
68
|
+
// RichTextEditor) is fed its untranspiled `.ts` — including
|
|
69
|
+
// `declare ['constructor']: …` fields — straight to Babel. Accepting
|
|
70
|
+
// `declare` fields is correct TS semantics (they are type-only and
|
|
71
|
+
// dropped from output) and is safe for all files, not just lexical.
|
|
72
|
+
['next/babel', {'preset-typescript': {allowDeclareFields: true}}],
|
|
73
|
+
],
|
|
62
74
|
plugins: [
|
|
63
75
|
[require.resolve('./babel.js'), stylexOptions(rootDir, overrides)],
|
|
64
76
|
],
|