Skip to content
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

How can we use it with typescript? #1

Closed
stgolem opened this issue Sep 28, 2017 · 5 comments
Closed

How can we use it with typescript? #1

stgolem opened this issue Sep 28, 2017 · 5 comments

Comments

@stgolem
Copy link

stgolem commented Sep 28, 2017

Is there any simple way to use this boilerplate with typescript + tsx?

@transitive-bullshit
Copy link
Owner

All you need to do is add the rollup typescript plugin (see rollup plugins) to rollup.config.js.

Note that I'm not 100% sure which order these plugins should go in, but I would think typescript should be at the top. If anyone else has more experience with typescript + rollup, I'd love some clarification @Victorystick @ezolenko.

@stgolem
Copy link
Author

stgolem commented Oct 1, 2017

I've done this with rollup-plugin-typescript2. Here is full config:

import babel from "rollup-plugin-babel";
import commonjs from "rollup-plugin-commonjs";
import postcss from "rollup-plugin-postcss";
import resolve from "rollup-plugin-node-resolve";
import typescript from "rollup-plugin-typescript2";

import pkg from "./package.json";

export default {
  input: "src/index.tsx",
  output: [
    {
      file: pkg.main,
      format: "cjs"
    },
    {
      file: pkg.module,
      format: "es"
    }
  ],
  external: ["react", "react-dom", "prop-types"],
  plugins: [
    typescript(),
    resolve(),
    commonjs(),
    postcss({}),
    babel({
      exclude: "node_modules/**"
    })
  ]
};

But with this i had to configure tsconfig.json with "allowJs": false

@transitive-bullshit
Copy link
Owner

Awesome -- thanks, @stgolem. I'll add this info to the readme.

@transitive-bullshit
Copy link
Owner

I'm publishing a Medium article on this and will link to this issue there. Thanks everyone!

@isha-bansal0115
Copy link

@transitive-bullshit: did you publish a medium article for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants