d3no-data icon indicating copy to clipboard operation
d3no-data copied to clipboard

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

Open ooker777 opened this issue 1 year ago • 1 comments

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/[email protected]/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/[email protected]/chart-comps/BarChart.tsx:1:1
  const manifest = (await import(toFileUrl(join(dir, "fresh.gen.ts")).href))
                    ^
    at async dev (https://deno.land/x/[email protected]/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/[email protected]/denonext/hooks.js:2:193)
    at k (https://esm.sh/stable/[email protected]/denonext/hooks.js:2:504)
    at Object.BarChart (https://deno.land/x/[email protected]/chart-comps/BarChart.tsx:380:3)
    at m (https://esm.sh/v135/[email protected]/X-ZS8q/denonext/preact-render-to-string.mjs:2:3237)
    at m (https://esm.sh/v135/[email protected]/X-ZS8q/denonext/preact-render-to-string.mjs:2:3802)
    at m (https://esm.sh/v135/[email protected]/X-ZS8q/denonext/preact-render-to-string.mjs:2:2543)
    at m (https://esm.sh/v135/[email protected]/X-ZS8q/denonext/preact-render-to-string.mjs:2:3802)
    at m (https://esm.sh/v135/[email protected]/X-ZS8q/denonext/preact-render-to-string.mjs:2:3802)
    at m (https://esm.sh/v135/[email protected]/X-ZS8q/denonext/preact-render-to-string.mjs:2:3802)
    at m (https://esm.sh/v135/[email protected]/X-ZS8q/denonext/preact-render-to-string.mjs:2:3802)
ReferenceError: React is not defined
    at Object.DefaultErrorPage (https://deno.land/x/[email protected]/src/server/default_error_page.tsx:2:3)
    at m (https://esm.sh/v135/[email protected]/X-ZS8q/denonext/preact-render-to-string.mjs:2:3237)
    at m (https://esm.sh/v135/[email protected]/X-ZS8q/denonext/preact-render-to-string.mjs:2:3802)
    at m (https://esm.sh/v135/[email protected]/X-ZS8q/denonext/preact-render-to-string.mjs:2:3802)
    at m (https://esm.sh/v135/[email protected]/X-ZS8q/denonext/preact-render-to-string.mjs:2:3802)
    at m (https://esm.sh/v135/[email protected]/X-ZS8q/denonext/preact-render-to-string.mjs:2:3802)
    at m (https://esm.sh/v135/[email protected]/X-ZS8q/denonext/preact-render-to-string.mjs:2:3802)
    at m (https://esm.sh/v135/[email protected]/X-ZS8q/denonext/preact-render-to-string.mjs:2:3802)
    at j (https://esm.sh/v135/[email protected]/X-ZS8q/denonext/preact-render-to-string.mjs:2:1742)
    at renderHtml (https://deno.land/x/[email protected]/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/[email protected]/denonext/hooks.js:2:208)
    at j (https://esm.sh/stable/[email protected]/denonext/hooks.js:2:910)
    at Object.BarChart (https://deno.land/x/[email protected]/chart-comps/BarChart.tsx:379:3)
    at m (https://esm.sh/v135/[email protected]/X-ZS8q/denonext/preact-render-to-string.mjs:2:3237)
    at m (https://esm.sh/v135/[email protected]/X-ZS8q/denonext/preact-render-to-string.mjs:2:3802)
    at m (https://esm.sh/v135/[email protected]/X-ZS8q/denonext/preact-render-to-string.mjs:2:2543)
    at m (https://esm.sh/v135/[email protected]/X-ZS8q/denonext/preact-render-to-string.mjs:2:3802)
    at m (https://esm.sh/v135/[email protected]/X-ZS8q/denonext/preact-render-to-string.mjs:2:2543)
    at m (https://esm.sh/v135/[email protected]/X-ZS8q/denonext/preact-render-to-string.mjs:2:3802)
    at m (https://esm.sh/v135/[email protected]/X-ZS8q/denonext/preact-render-to-string.mjs:2:3802)

ooker777 avatar Apr 13 '24 07:04 ooker777

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.

gibbygano avatar Oct 13 '24 06:10 gibbygano