FountainJS / generator-fountain-webapp

Yeoman 'fountain' generator to start a webapp
http://fountainjs.io
MIT License
967 stars 67 forks source link

*.ts Files not Transpiled by Default #215

Closed pdemro closed 5 years ago

pdemro commented 6 years ago

Description

*.ts Files do not transpile/webpack by default.

Error Message & Stack Trace

Module parse failed: /home/name/source/repos/demro/project/src/app/ss-service/project.service.ts Unexpected token (30:11)
You may need an appropriate loader to handle this file type.
| 
| 
|     public static SomeMethod(someParameter) {
| 
| 

Config

{
  "generator-fountain-react": {
    "version": "1.0.0",
    "props": {
      "framework": "react",
      "modules": "webpack",
      "js": "typescript",
      "ci": "",
      "css": "scss",
      "resolved": "/home/phillip/.nvm/versions/node/v8.6.0/lib/node_modules/generator-fountain-webapp/node_modules/generator-fountain-react/generators/app/index.js",
      "namespace": "fountain-react:app",
      "_": [],
      "sample": "todoMVC",
      "router": "router"
    }
  }
}

Environment

Tell us which operating system you are using, as well as which versions of Node.js, npm, and yo. Run the following to get it quickly:

generator-fountain-webapp@1.0.0 
Node.js v8.6.0
linux 4.10.0-37-generic
yo --version
2.0.0
npm --version
5.3.0
pdemro commented 6 years ago

Very simple fix for this bug is to add *.ts files to the webpack config

      {
        test: /\.ts$/,
        exclude: /node_modules/,
        loaders: [
          'react-hot-loader',
          //'ts-loader'
          'ts-loader?' + JSON.stringify({ignoreDiagnostics:[2345, 2307]})
        ]
      }