Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support declare in babel configuration for Typescript #118926

Closed
exalate-issue-sync bot opened this issue Nov 17, 2021 · 0 comments · Fixed by #119107
Closed

Support declare in babel configuration for Typescript #118926

exalate-issue-sync bot opened this issue Nov 17, 2021 · 0 comments · Fixed by #119107
Labels
impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. loe:small Small Level of Effort Team:Operations Team label for Operations Team

Comments

@exalate-issue-sync
Copy link

exalate-issue-sync bot commented Nov 17, 2021

When using declare (example patch), the optimizer will fail with:

node scripts/build_kibana_platform_plugins.js 
 info initialized, 0 bundles cached
 info starting worker [24 bundles]
 info starting worker [24 bundles]
 info starting worker [23 bundles]
 info starting worker [24 bundles]
 info starting worker [23 bundles]
 info starting worker [23 bundles]
 info [20/141] initial bundle builds complete
 info [37/141] initial bundle builds complete
 info [50/141] initial bundle builds complete
 info [66/141] initial bundle builds complete
 info [77/141] initial bundle builds complete
 info [83/141] initial bundle builds complete
 info [98/141] initial bundle builds complete
 info [105/141] initial bundle builds complete
 info [109/141] initial bundle builds complete
 info [112/141] initial bundle builds complete
 info [115/141] initial bundle builds complete
 info [121/141] initial bundle builds complete
 info [130/141] initial bundle builds complete
 info [136/141] initial bundle builds complete
 info [139/141] initial bundle builds complete
ERROR webpack compile errors
   │ERROR [dashboard] build
       │ERROR Optimizations failure.
       │         275 modules
       │          
       │          ERROR in ./public/application/embeddable/viewport/dashboard_viewport.tsx
       │          Module build failed (from /home/tyler/elastic/kibana/node_modules/babel-loader/lib/index.js):
       │          SyntaxError: /home/tyler/elastic/kibana/src/plugins/dashboard/public/application/embeddable/viewport/dashboard_viewport.tsx: TypeScript 'declare' fields must first be transformed by @babel/plugin-transform-typescript.
       │          If you have already enabled that plugin (or '@babel/preset-typescript'), make sure that it runs before any plugin related to additional class features:
       │           - @babel/plugin-proposal-class-properties
       │           - @babel/plugin-proposal-private-methods
       │           - @babel/plugin-proposal-decorators
       │            33 | export class DashboardViewport extends React.Component<DashboardViewportProps, State> {
       │            34 |   static contextType = context;
       │          > 35 |   public declare readonly context: DashboardReactContextValue;
       │               |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       │            36 |
       │            37 |   private controlsRoot: React.RefObject<HTMLDivElement>;
       │            38 |
       │              at File.buildCodeFrameError (/home/tyler/elastic/kibana/node_modules/@babel/core/lib/transformation/file/file.js:249:12)
       │              at NodePath.buildCodeFrameError (/home/tyler/elastic/kibana/node_modules/@babel/traverse/lib/path/index.js:139:21)
       │              at Object.assertFieldTransformed (/home/tyler/elastic/kibana/node_modules/@babel/plugin-proposal-class-properties/node_modules/@babel/helper-create-class-features-plugin/lib/typescript.js:10:16)
       │              at buildFieldsInitNodes (/home/tyler/elastic/kibana/node_modules/@babel/plugin-proposal-class-properties/node_modules/@babel/helper-create-class-features-plugin/lib/fields.js:788:34)
       │              at PluginPass.Class (/home/tyler/elastic/kibana/node_modules/@babel/plugin-proposal-class-properties/node_modules/@babel/helper-create-class-features-plugin/lib/index.js:181:48)
       │              at newFn (/home/tyler/elastic/kibana/node_modules/@babel/traverse/lib/visitors.js:177:21)
       │              at NodePath._call (/home/tyler/elastic/kibana/node_modules/@babel/traverse/lib/path/context.js:53:20)
       │              at NodePath.call (/home/tyler/elastic/kibana/node_modules/@babel/traverse/lib/path/context.js:40:17)
       │              at NodePath.visit (/home/tyler/elastic/kibana/node_modules/@babel/traverse/lib/path/context.js:90:31)
       │              at TraversalContext.visitQueue (/home/tyler/elastic/kibana/node_modules/@babel/traverse/lib/context.js:103:16)
       │           @ ./public/application/embeddable/dashboard_container.tsx 17:0-66 157:89-106
       │           @ ./public/application/embeddable/dashboard_container_factory.tsx
       │           @ ./public/application/embeddable/index.ts
       │           @ ./public/application/index.ts
       │           @ ./public/index.ts
       │           @ /home/tyler/elastic/kibana/node_modules/@kbn/optimizer/target_node/worker/entry_point_creator.js
ERROR webpack issue
@exalate-issue-sync exalate-issue-sync bot added impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. loe:small Small Level of Effort labels Nov 17, 2021
@botelastic botelastic bot added the needs-team Issues missing a team label label Nov 17, 2021
@dmlemeshko dmlemeshko added the Team:Operations Team label for Operations Team label Nov 19, 2021
@botelastic botelastic bot removed the needs-team Issues missing a team label label Nov 19, 2021
@exalate-issue-sync exalate-issue-sync bot reopened this Nov 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. loe:small Small Level of Effort Team:Operations Team label for Operations Team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant