File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -65,6 +65,7 @@ class Config {
6565 disableLazyImports : false ,
6666 } ,
6767 autoPolyfills : false ,
68+ babelIncludes : [ ] ,
6869 } ;
6970 }
7071}
Original file line number Diff line number Diff line change @@ -61,6 +61,22 @@ export type IOptions = {
6161 * @param {HookOptions[] }
6262 */
6363 plugins ?: HookOptions [ ] ;
64+ /**
65+ * Additional packages/paths to transpile via Babel, on top of ko's defaults.
66+ *
67+ * ko already transpiles these by default (they publish ES2020+ syntax):
68+ * - `immer`
69+ * - `react-grid-layout`
70+ * - `monaco-editor`
71+ * - internal `dt-common` source (`node_modules/dt-common/src/**`)
72+ *
73+ * You do not need to re-list them here. Use this to add your own
74+ * ES2020+ packages that ko doesn't know about. Entries are matched
75+ * as substring against the file path.
76+ *
77+ * @param {string[] }
78+ */
79+ babelIncludes ?: string [ ] ;
6480 /**
6581 * The path to the HTML template to use for the application.
6682 * @param {string }
Original file line number Diff line number Diff line change @@ -76,7 +76,11 @@ class Script {
7676 return true ;
7777 } else if ( input . includes ( 'monaco-editor' ) ) {
7878 return true ;
79- } else if ( input . includes ( 'node_modules' ) ) {
79+ }
80+ if ( this . opts . babelIncludes ?. some ( item => item && input . includes ( item ) ) ) {
81+ return true ;
82+ }
83+ if ( input . includes ( 'node_modules' ) ) {
8084 return false ;
8185 } else {
8286 return true ;
You can’t perform that action at this time.
0 commit comments