Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

(rpt2 plugin) semantic error TS2304: Cannot find name 'h'. #622

Copy link
Copy link
@MarkLyck

Description

@MarkLyck
Issue body actions

This is related to #608 but the solution does not work for me and the core issue was never solved.

My build was working on 0.1.11
My build fails on 0.1.12

cli command: yarn microbundle

Error:

yarn run v1.17.3
$ microbundle
(rpt2 plugin) Error: /Users/marklyck/colony/colony-app/src/Admin/index.tsx(58,6): semantic error TS2304: Cannot find name 'h'.
Error: /Users/marklyck/colony/colony-app/src/Admin/index.tsx(58,6): semantic error TS2304: Cannot find name 'h'.
    at error (/Users/marklyck/colony/colony-app/node_modules/rollup/dist/shared/node-entry.js:5400:30)
    at throwPluginError (/Users/marklyck/colony/colony-app/node_modules/rollup/dist/shared/node-entry.js:11878:12)
    at Object.error (/Users/marklyck/colony/colony-app/node_modules/rollup/dist/shared/node-entry.js:12912:24)
    at Object.error (/Users/marklyck/colony/colony-app/node_modules/rollup/dist/shared/node-entry.js:12081:38)
    at RollupContext.error (/Users/marklyck/colony/colony-app/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:17194:30)
    at /Users/marklyck/colony/colony-app/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:24958:23
    at arrayEach (/Users/marklyck/colony/colony-app/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:534:11)
    at forEach (/Users/marklyck/colony/colony-app/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:9360:14)
    at printDiagnostics (/Users/marklyck/colony/colony-app/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:24931:5)
    at Object.transform (/Users/marklyck/colony/colony-app/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:27374:17)

this happens on the first line of JSX I have in my .tsx file.

looking into this h it seems to be an alias for jsx

jsx: options.jsx || 'h',

The suggested solution in the other ticket was adding --jsx to the command.

microbundle -f es,cjs --jsx React.createElement.

However this did not solve the problem for me it seems.

When running the above command I get the following error instead:

yarn run v1.17.3
$ /Users/marklyck/colony/colony-app/node_modules/.bin/microbundle -f es,cjs --jsx React.createElement
(rpt2 plugin) Error: /Users/marklyck/colony/colony-app/src/Admin/Providers.tsx(15,3): semantic error TS17016: JSX fragment is not supported when using --jsxFactory
Error: /Users/marklyck/colony/colony-app/src/Admin/Providers.tsx(15,3): semantic error TS17016: JSX fragment is not supported when using --jsxFactory
    at error (/Users/marklyck/colony/colony-app/node_modules/rollup/dist/shared/node-entry.js:5400:30)
    at throwPluginError (/Users/marklyck/colony/colony-app/node_modules/rollup/dist/shared/node-entry.js:11878:12)
    at Object.error (/Users/marklyck/colony/colony-app/node_modules/rollup/dist/shared/node-entry.js:12912:24)
    at Object.error (/Users/marklyck/colony/colony-app/node_modules/rollup/dist/shared/node-entry.js:12081:38)
    at RollupContext.error (/Users/marklyck/colony/colony-app/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:17194:30)
    at /Users/marklyck/colony/colony-app/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:24958:23
    at arrayEach (/Users/marklyck/colony/colony-app/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:534:11)
    at forEach (/Users/marklyck/colony/colony-app/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:9360:14)
    at printDiagnostics (/Users/marklyck/colony/colony-app/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:24931:5)
    at Object.transform (/Users/marklyck/colony/colony-app/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:27374:17)

either way forcing the --jsx doesn't seem to be a solution, but rather a workaround.

I don't believe microbundle is meant to require this?

Here is my tsconfig.json:

{
  "compilerOptions": {
    "outDir": "./dist/",
    "module": "esNext",
    "strictNullChecks": true,
    "moduleResolution": "node",
    "esModuleInterop": true,
    "experimentalDecorators": true,
    "jsx": "react",
    "noUnusedParameters": true,
    "noUnusedLocals": true,
    "noImplicitAny": true,
    "noImplicitThis": true,
    "declaration": true,
    "allowSyntheticDefaultImports": true,
    "emitDecoratorMetadata": true,
    "target": "es2019",
    "lib": ["es5", "es6", "es7", "es2017", "dom"],
    "sourceMap": true,
    "types": ["react", "jest", "node"],
    "baseUrl": ".",
    "paths": {
      "~*": ["./src/*"],
      "common/*": ["src/common/*"],
      "tests/*": ["tests/*"]
    }
  },
  "include": ["src/**/*", "src/typings.d.ts", "@types"],
  "exclude": ["./node_modules", "dist"]
}

and my .babelrc

module.exports = {
  presets: ["@babel/preset-react", "@babel/preset-typescript"],
  plugins: [
    "styled-components",
    "@babel/plugin-syntax-export-default-from",
    [
      "module-resolver",
      {
        root: ["."],
        alias: {
          "~": "./src/",
          common: "./src/common",
          Admin: "./src/Admin",
          tests: "./tests",
        },
      },
    ],
  ],
};
Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.