When syncing a repo, I'm getting all these unwanted overrides.
--- Compiler configuration (1.0.3 original)
+++ Compiler configuration (1.0.3 modified)
{
- "compilerPath": "typescript/bin/tsc",
- "compilerArguments": [
- - "--declaration"
- ],
- "compiledFileTypes": [
- - ".ts",
- - ".tsx"
- ],
- "configFileName": "tsconfig.json",
- "tsconfig": {
- - "compilerOptions": {
- - - "outDir": "dist",
- - - "target": "ES5",
- - - "sourceMap": false,
- - - "moduleResolution": "Node",
- - - "esModuleInterop": true,
- - - "module": "CommonJS",
- - - "allowSyntheticDefaultImports": true,
- - - "resolveJsonModule": true,
- - - "declaration": true,
- - - "experimentalDecorators": true,
- - - "inlineSourceMap": false,
- - - "inlineSources": false,
- - - "lib": [
- - - - "dom",
- - - - "es2015"
- - - ],
- - - "jsx": "react",
- - - "rootDir": "./",
- - - "removeComments": true,
- - - "typeRoots": [
- - - - "./node_modules/@types"
- - - ],
- - - "importHelpers": false
- - },
- - "include": [
- - - "./**/*"
- - ],
- - "exclude": [
- - - "node_modules",
- - - ".dependencies",
- - - "dist"
- - ]
- },
- "development": false,
- "copyPolicy": {
- - "ignorePatterns": [
- - - "package.json",
- - - "package-lock.json",
- - - "tsconfig.json"
- - ],
- - "disable": false
- }
}
{
+ "tsconfig": {
+ + "compilerOptions": {
+ + + "target": "ES5",
+ + + "module": "CommonJS"
+ + }
+ }
}
...
I believe this is happening because bit stores 'dynamic compiler configuration' in the component metadata during the _build process_.
When the component is imported, bit detects these configurations as missing overrides, and marks the components as modified.
(Sometimes, bit also bridges this gap and adds the changes to package.json)
I think this can be fixed in 2 places:
getDynamicConfig()(?) in the TS and TS-react compilers. The configuration is default and static, and not needed as metadata. I talked to @qballer about it, but we never made a followup.You can see when syncing bit in the Evangelist project.
bit importbit checkout -a latestsuccessful sync without side effects
all imported components have their override modified.
bit import and bit checkoutbit build to recreate compiler overrides in local memory. (it might fail on first build, run again to pass)--> bit diff should show 0 changes.
actually, seems like bit build fixes this.
Seems like something that should happen automatically on import without having to build the project at all.
I added this script to my package.json to automate this:
"scripts": {
"build": "react-scripts build",
"eject": "react-scripts eject",
"start": "react-scripts start",
"test": "react-scripts test",
+ "setup": "bit init && bit import -e && bit build"
},
I believe this won't be relevant anymore after the harmony release. but let's keep monitor this in the future.
@KutnerUri @davidfirst
Hi, I would like to add something to this bug if I may (LMK if this should be in a separate issue):
When I tried to import the latest version of a component (bit import && bit checkout 1.0.2 <component-name>), the main file was updated, but the file with the actual component code was overridden.
When I bit diff'ed the component, I was shown the same diff as in this issue (tsconfig), but ALSO all the changes from v1.0.2 were changed back to the code in the previous version, v1.0.1.
This diff is only reflected in Bit, as far as Git goes - the files are unmodified, so I can't even discard the changes.
I'm using 14.8.8. Any suggestion/thought would be appreciated!
UPDATE: I've found the issue and was able to solve it. It might happened because of me fiddling with stuff that I shouldn't have, OR there might be an actual bug. When I get the time I'll double-check and if there's indeed one I'll open a new issue accordingly. Thanks!
Most helpful comment
I believe this won't be relevant anymore after the harmony release. but let's keep monitor this in the future.
@KutnerUri @davidfirst