grid icon indicating copy to clipboard operation
grid copied to clipboard

Runtime JavaScript error with v8.0.8

Open esakylli opened this issue 4 years ago • 7 comments

I have been successfully using v7.0.1 from npm. But when I updated to v8.0.8 I get a JavaScript error in Chrome's console (see attached image), as soon as I have the Grid imported on my page. Any suggestions what may cause it? Has the build/publish process changed after v7.0.1? rowsncolumns-grid-8_0_8

esakylli avatar Aug 18 '21 14:08 esakylli

There was no significant changes in v8. What version of typescript are you using ? How are you importing the grid?

rmdort avatar Aug 18 '21 14:08 rmdort

I'm using TypeScript 4.2.3, and here's how I import the grid: import { autoSizerCanvas, CellInterface, Grid, GridRef, Cell, RendererProps, UseEditableOptions, useEditable, useSelection, } from "@rowsncolumns/grid";

If I compile your code in my dev environment, it works.

esakylli avatar Aug 19 '21 10:08 esakylli

I guess some import might be conflicting.. Can you share your tsconfig settings.. If you could reproduce this on codesandbox, will be helpful

rmdort avatar Aug 19 '21 10:08 rmdort

I just looked at the generated JS-file for grid. There seems to be a difference in the module loading.

Here's the old snippet: var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; };

Here's the new snippet (v8.0.8): var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; };

esakylli avatar Aug 19 '21 11:08 esakylli

Maybe you have used a different version of tsc when building/publishing?

esakylli avatar Aug 19 '21 11:08 esakylli

I dont have a way to reproduce this. You can share your tsconfig.json or use codesandbox to reproduce this error.

rmdort avatar Aug 19 '21 12:08 rmdort

Unfortunately, I didn't manage to reproduce the error in codesandbox.

Here's my tsconfig.json:

{ "extends": "../tsconfig.settings.json", "compilerOptions": { "outDir": "lib", "rootDir": "src", "lib": ["dom", "es2015", "es2017.object", "esnext.asynciterable", "esnext"] } }

tsconfig.settings.json:

{ "compilerOptions": { "target": "es5", "module": "commonjs", "declaration": true, "declarationMap": true, "sourceMap": true, "composite": true, "esModuleInterop": true, "downlevelIteration": true, "jsx": "react", "newLine": "LF", "noEmitOnError": false, "noFallthroughCasesInSwitch": true, "noImplicitAny": true, "noImplicitReturns": true, "noImplicitThis": true, "noUnusedLocals": true, "noUnusedParameters": true, "strictNullChecks": true, "lib": ["esnext"], "noErrorTruncation": true } }

esakylli avatar Aug 19 '21 12:08 esakylli