oslabs-beta / d3no-data

chart component library for fresh
https://d3nodata.deno.dev/
MIT License
81 stars 2 forks source link

TypeError: pragma cannot be set when runtime is automatic when updating Fresh to v1.6.1 #70

Open ooker777 opened 7 months ago

ooker777 commented 7 months ago

Cloning https://github.com/D3nosaurs/d3nodata-website I successfully make a minimal app with only 2 files: islands/ChartContainer.tsx:

/** @jsx h */
import { h } from "preact";
import {BarChart} from "https://deno.land/x/d3nodata@v.0.1.1/charts.ts";
const barDatasets = [{
  label: 'test',
  color: 'green',
  data: [
    {
      y: 2,
      x: 1
    }, 
    {
      y: 10,
      x: 2
    } 
  ]
}];

export default function D3nodata() {
  return (<BarChart datasets={barDatasets}></BarChart>);
}

routes/index.tsx:

/** @jsx h */
import { h } from "preact";
import ChartContainer from "../islands/ChartContainer.tsx";

export default function SamplesPage() {
  return (
      <ChartContainer />
  );
}

That's Fresh v1.0.2 and D3no Data v.0.1.1.

If I update Fresh to v1.6.8:

deno run -A -r https://fresh.deno.dev/update .

It will ask this question:

This project is using the classic JSX transform. Would you like to update to the 
automatic JSX transform? This will remove the /** @jsx h */ pragma from your
source code and add the jsx: "react-jsx" compiler option to your deno.json file. [y/N]

Different answers will yield different errors:

Yes

TypeError: pragma cannot be set when runtime is automatic at https://deno.land/x/d3nodata@v.0.1.1/chart-comps/BarChart.tsx:1:1
  const manifest = (await import(toFileUrl(join(dir, "fresh.gen.ts")).href))
                    ^
    at async dev (https://deno.land/x/fresh@1.6.8/src/dev/dev_command.ts:38:21)
    at async file:///D:/Programming/Deno/d3nodata-website/dev.ts:5:1
Watcher Process failed. Restarting on file change...

No

TypeError: Cannot read properties of undefined (reading '__H')
    at f (https://esm.sh/stable/preact@10.8.2/denonext/hooks.js:2:193)
    at k (https://esm.sh/stable/preact@10.8.2/denonext/hooks.js:2:504)
    at Object.BarChart (https://deno.land/x/d3nodata@v.0.1.1/chart-comps/BarChart.tsx:380:3)
    at m (https://esm.sh/v135/preact-render-to-string@6.3.1/X-ZS8q/denonext/preact-render-to-string.mjs:2:3237)
    at m (https://esm.sh/v135/preact-render-to-string@6.3.1/X-ZS8q/denonext/preact-render-to-string.mjs:2:3802)
    at m (https://esm.sh/v135/preact-render-to-string@6.3.1/X-ZS8q/denonext/preact-render-to-string.mjs:2:2543)
    at m (https://esm.sh/v135/preact-render-to-string@6.3.1/X-ZS8q/denonext/preact-render-to-string.mjs:2:3802)
    at m (https://esm.sh/v135/preact-render-to-string@6.3.1/X-ZS8q/denonext/preact-render-to-string.mjs:2:3802)
    at m (https://esm.sh/v135/preact-render-to-string@6.3.1/X-ZS8q/denonext/preact-render-to-string.mjs:2:3802)
    at m (https://esm.sh/v135/preact-render-to-string@6.3.1/X-ZS8q/denonext/preact-render-to-string.mjs:2:3802)
ReferenceError: React is not defined
    at Object.DefaultErrorPage (https://deno.land/x/fresh@1.6.8/src/server/default_error_page.tsx:2:3)
    at m (https://esm.sh/v135/preact-render-to-string@6.3.1/X-ZS8q/denonext/preact-render-to-string.mjs:2:3237)
    at m (https://esm.sh/v135/preact-render-to-string@6.3.1/X-ZS8q/denonext/preact-render-to-string.mjs:2:3802)
    at m (https://esm.sh/v135/preact-render-to-string@6.3.1/X-ZS8q/denonext/preact-render-to-string.mjs:2:3802)
    at m (https://esm.sh/v135/preact-render-to-string@6.3.1/X-ZS8q/denonext/preact-render-to-string.mjs:2:3802)
    at m (https://esm.sh/v135/preact-render-to-string@6.3.1/X-ZS8q/denonext/preact-render-to-string.mjs:2:3802)
    at m (https://esm.sh/v135/preact-render-to-string@6.3.1/X-ZS8q/denonext/preact-render-to-string.mjs:2:3802)
    at m (https://esm.sh/v135/preact-render-to-string@6.3.1/X-ZS8q/denonext/preact-render-to-string.mjs:2:3802)
    at j (https://esm.sh/v135/preact-render-to-string@6.3.1/X-ZS8q/denonext/preact-render-to-string.mjs:2:1742)
    at renderHtml (https://deno.land/x/fresh@1.6.8/src/server/rendering/template.tsx:51:16)

Using D3no Data v0.1.3.1

TypeError: Cannot read properties of undefined (reading '__H')
    at a (https://esm.sh/stable/preact@10.11.0/denonext/hooks.js:2:208)
    at j (https://esm.sh/stable/preact@10.11.0/denonext/hooks.js:2:910)
    at Object.BarChart (https://deno.land/x/d3nodata@v0.1.3.1/chart-comps/BarChart.tsx:379:3)
    at m (https://esm.sh/v135/preact-render-to-string@6.3.1/X-ZS8q/denonext/preact-render-to-string.mjs:2:3237)
    at m (https://esm.sh/v135/preact-render-to-string@6.3.1/X-ZS8q/denonext/preact-render-to-string.mjs:2:3802)
    at m (https://esm.sh/v135/preact-render-to-string@6.3.1/X-ZS8q/denonext/preact-render-to-string.mjs:2:2543)
    at m (https://esm.sh/v135/preact-render-to-string@6.3.1/X-ZS8q/denonext/preact-render-to-string.mjs:2:3802)
    at m (https://esm.sh/v135/preact-render-to-string@6.3.1/X-ZS8q/denonext/preact-render-to-string.mjs:2:2543)
    at m (https://esm.sh/v135/preact-render-to-string@6.3.1/X-ZS8q/denonext/preact-render-to-string.mjs:2:3802)
    at m (https://esm.sh/v135/preact-render-to-string@6.3.1/X-ZS8q/denonext/preact-render-to-string.mjs:2:3802)
gibbygano commented 1 month ago

Wanted to second on this issue. I know this project hasn't been updated in a while, but it is still living on the Deno Fresh showcase page so it seems a shame its not working with versions of Fresh that have been out for the last year or so.