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
Tensorflow NPM Packages are shipping TypeScript sources instead of just the distrubtion files [URGENT] #3617
Comments
@jbis9051 can you please provide steps to reproduce above error ? |
@rthadur The linked reddit post describes why it's an issue better. Reproduce$ mkdir test
$ cd test
$ npm init
$ npm install --save @tensorflow/tfjs In .
├── tfjs
├── tfjs-backend-cpu
├── tfjs-backend-webgl
├── tfjs-converter
├── tfjs-core
├── tfjs-data
└── tfjs-layers Inside all of these packages is something similar to the following: ├── tfjs-core
│ ├── BUILD.bazel
│ ├── README.md
│ ├── cloudbuild.yml
│ ├── development
│ ├── dist
│ ├── package.json
│ ├── scripts
│ ├── src
│ ├── test.html
│ └── tsconfig.test.json Instead, only the Why this is an issue?For starters, including the source files (used for developing) increases package sizes tremendously and unnecessarily. Additionally, and more importantly, if you are using typescript in a project TypeScript will do type checks on the tensorflow source despite excluding How do you guys fix it?For TypeScript based packages you should only publish the built ( If you look at bodyPix, that package is setup properly:
Despite BodyPix having a If we go into the dist folder then we can see all the compiled source and deceleration files. |
Same issue here |
@tylerzhu-github can you please help with above request ? |
same here |
@jbis9051 What version of typescript are you using? Could you post your tsconfig (or a similar tsconfig that reproduces the error), we've been shipping those up to NPM for a while and it would be nice to know why skipLibCheck/exclude does not work in this instance. |
@tafsiri Sure.
Not sure about why exclude doesn't work. Version: Here's a TSConfig: {
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react",
"experimentalDecorators": true
},
"include": [
"src"
],
"exclude": [
"node_modules"
]
} It isn't compatible because |
Also add a custom lint rule to disable such imports. We should be able to import from a relative within the src folder of a given folder. Not doing so changes the resolution path for typescript users in the published packaged. fixes #3617
Found the bug, it was an errant import path in our source. Should be resolved in the next release goes out. |
\o/ |
Yeah, i independently found the problem (using
diff --git a/node_modules/@tensorflow/tfjs-core/dist/kernel_names.d.ts b/node_modules/@tensorflow/tfjs-core/dist/kernel_names.d.ts
index 126a329..b287921 100644
--- a/node_modules/@tensorflow/tfjs-core/dist/kernel_names.d.ts
+++ b/node_modules/@tensorflow/tfjs-core/dist/kernel_names.d.ts
@@ -14,7 +14,7 @@
* limitations under the License.
* =============================================================================
*/
-import { ExplicitPadding } from '../src/ops/conv_util';
+import { ExplicitPadding } from './ops/conv_util';
import { NamedTensorInfoMap, TensorInfo } from './kernel_registry';
import { DataType, PixelData } from './types';
export declare const Add = "Add";
diff --git a/node_modules/@tensorflow/tfjs-core/src/kernel_names.ts b/node_modules/@tensorflow/tfjs-core/src/kernel_names.ts
index 4e9a822..c998fdb 100644
--- a/node_modules/@tensorflow/tfjs-core/src/kernel_names.ts
+++ b/node_modules/@tensorflow/tfjs-core/src/kernel_names.ts
@@ -18,7 +18,7 @@
// tslint:disable: variable-name
// Unfortunately just enabling PascalCase per file (tslint:enable:
// allow-pascal-case) doesn't work.
-import {ExplicitPadding} from '../src/ops/conv_util';
+import {ExplicitPadding} from './ops/conv_util';
import {NamedTensorInfoMap, TensorInfo} from './kernel_registry';
import {DataType, PixelData} from './types'; |
BUG Also adds a custom lint rule to disable such imports. Fixes #3617
This is in my package.json
I'm getting this error:
I also tried
"skipLibCheck": true
intsconfig.json
but that didn't work either.Related https://www.reddit.com/r/typescript/comments/hjgd30/skiplibcheck_but_for_ts_files/
The text was updated successfully, but these errors were encountered: