GitHunt
KI

kidqn/create-react-app-ts-sass

Configure typescript and sass for create react app

#Config TS to CRA

  • Change in paths.js
    appIndexJs: resolveApp('src/index.tsx')
  • add ts-loader to webpack config dev
    *// Process TS/TSX with Babel
    {
    test: /.(ts|tsx)$/,
    include: paths.appSrc,
    loaders: ['babel-loader', 'ts-loader']
    },
    /.(js|jsx)$/,
    /.(ts|tsx)$/,
  • extensions: ['.web.js', '.js', '.json', '.web.jsx', '.jsx', 'ts', 'tsx'],
  • add tsconfig.json
  • add @types/react": "^15.0.39", "@types/react-dom": "^15.5.1"

Config Sass to CRA

 * //Process Sass/Scss
  {
    test: /\.(scss|sass)$/,
    include: paths.appSrc,
    use: ['style-loader', 'css-loader', 'sass-loader?sourceMap=true']
  },

Languages

JavaScript78.2%TypeScript15.3%CSS3.9%HTML2.7%

Contributors

Created July 26, 2017
Updated July 26, 2017
kidqn/create-react-app-ts-sass | GitHunt