Conversation
Codecov Report
@@ Coverage Diff @@
## master #1354 +/- ##
=======================================
Coverage 72.92% 72.92%
=======================================
Files 775 775
Lines 5824 5824
Branches 1721 1698 -23
=======================================
Hits 4247 4247
Misses 1571 1571
Partials 6 6
Continue to review full report at Codecov.
|
…m/stardust-ui/react into chore/babel-loader
@@ -1,6 +1,7 @@ | |||
{ | |||
"extends": "./tsconfig.common.json", | |||
"compilerOptions": { | |||
"isolatedModules": false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this config and the next one are used for yarn build
scenarios, where Babel is not used.
This is necessary to ensure that type declarations will be generated.
@@ -1 +1,2 @@ | |||
export { default, ComponentExampleProps } from './ComponentExample' | |||
export * from './ComponentExample' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these changes in exports are necessary to make TS with --isolatedModules
flag work - this flag ensures that TS compiler uses the same 'file-by-file' processing strategy as Babel
@@ -8,13 +8,8 @@ export type Extendable<T, V = any> = T & { | |||
[key: string]: V | |||
} | |||
|
|||
export type Nullable<T> = T | null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all these are unused, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly 😇
@@ -1,3 +1,5 @@ | |||
import '@babel/polyfill' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you, please, suggest why this change was necessary? where it is used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It contains regeneratorRuntime
that it's required by async/await
transform.
just couple of moments that we might add to the description (all those are mentioned in the comments):
|
…m/stardust-ui/react into chore/babel-loader # Conflicts: # packages/react/src/index.ts
Generated by 🚫 dangerJS |
Related #508.
Enable
isolatedModules
in TScompilerOptions
Babel behaves as if the
--isolatedModules
option was passed to the TypeScript Compiler and this can't be worked around because Babel doesn't support cross-file analysis.How does Babel handle TypeScript code? It removes it, it strips out all the TypeScript, turns it into "regular" JavaScript. Any bundler don't know anything about types because don't exists in runtime and that's why types can't be reexported.
https://babeljs.io/docs/en/babel-plugin-transform-typescript
Updates in exports
As mentioned before we can't reexport types, that's why exports were transformed:
Before
After
types.internal.ts
These files will contain shared and reusable types in package, but these types shouldn't be part of a public API and can't be exported.
Remove
awesome-typescript-loader
&ts-loader
Was replaced with
babel-loader
andfork-ts-checker-webpack-plugin
to keep type checks.Add
fork-ts-checker-webpack-plugin
Webpack plugin that runs TypeScript type checker on a separate process. It allows very fast compile code by
babel-loader
and run type checks parallel, so by switching to Babel we will not loose TS checks.This PR do not resolve issues with HMR.