Skip to content

Commit

Permalink
Override tsc options for plugins
Browse files Browse the repository at this point in the history
Plugins will sometimes have their own `tsconfig.json`, which will
interfere with the dev server config if configured inappropriately.

This change makes sure `tsc` (and `ts-loader`) always compiles to
`esnext` modules, so we don't get "Uncaught ReferenceError: exports
is not defined" error.
  • Loading branch information
ktmud committed Mar 30, 2020
1 parent 08cf909 commit 83723e6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions superset-frontend/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@
"include": [
"./src/**/*",
"./spec/**/*",
// include the source code of each plugin
"./node_modules/*superset-ui*/**/src/**/*",
"./node_modules/*superset-ui*/**/types/**/*",
// and the type defs of their dependencies
"./node_modules/*superset-ui*/**/node_modules/**/*.d.ts"
]
}
9 changes: 9 additions & 0 deletions superset-frontend/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,15 @@ const config = {
// type checking is done via fork-ts-checker-webpack-plugin
happyPackMode: true,
transpileOnly: true,
// must override compiler options here, even though we have set
// the same options in `tsconfig.json`, because they may still
// be overriden by `tsconfig.json` in node_modules subdirectories.
compilerOptions: {
esModuleInterop: false,
importHelpers: false,
module: 'esnext',
target: 'esnext',
},
},
},
],
Expand Down

0 comments on commit 83723e6

Please sign in to comment.