keokilee / react-typescript-boilerplate

Boilerplate project for setting up Typescript and React with Babel and Webpack.
ISC License
114 stars 23 forks source link

Example errors out with Typescript no output #158

Open jschaf opened 8 years ago

jschaf commented 8 years ago

I'm having a ton of trouble trying to get the example to run. I cloned the repository and ran npm install and tsd install. After running npm start, I get the following output:

C:\Users\joe\prog\react-typescript-boilerplate>npm start

> react-typescript-boilerplate@1.0.0 start C:\Users\joe\prog\react-typescript-boilerplate
> node dev_server.js

Listening at http://localhost:3000
ts-loader: Using typescript@1.8.2 and C:\Users\joe\prog\react-typescript-boilerplate\tsconfig.json
webpack built abbe0a7a735d670bb7c7 in 2155ms
Hash: abbe0a7a735d670bb7c7
Version: webpack 1.12.14
Time: 2155ms
 Asset     Size  Chunks       Chunk Names
app.js  32.4 kB       0       main
chunk    {0} app.js (main) 8.29 kB [rendered]
    [0] multi main 40 bytes {0} [built] [1 error]
    [1] (webpack)-hot-middleware/client.js 3.43 kB {0} [built]
    [2] (webpack)/buildin/module.js 251 bytes {0} [built]
    [3] ./~/strip-ansi/index.js 161 bytes {0} [built]
    [4] ./~/ansi-regex/index.js 135 bytes {0} [built]
    [5] (webpack)-hot-middleware/client-overlay.js 1.01 kB {0} [built]
    [6] (webpack)-hot-middleware/process-update.js 3.27 kB {0} [built]
ERROR in ./app/index.tsx
Module build failed: Error: Typescript emitted no output for C:\Users\joe\prog\react-typescript-boilerplate\app\index.tsx
    at Object.loader (C:\Users\joe\prog\react-typescript-boilerplate\node_modules\ts-loader\index.js:437:15)
 @ multi main

If I browse to localhost:3000, I get index.html but static/app.js seems has the same contents as index.html so Chrome fails to parse the the javascript file.

Did I miss a step?

jschaf commented 8 years ago

If I remove the noEmit: true from tsconfig.json, the example works. Is noEmit supposed to be set to true? It looks like it gets loaded with webpack-dev-middleware.

keokilee commented 8 years ago

That's interesting. I think it's because of the new version of TS. Maybe the thing to do is to just remove that line from tsconfig.json.

nunobaba commented 8 years ago

UPDATE: Somehow, by cleaning the output js file, the build went through. Take the following as if it was a bad dream.

While noEmit: true gets rid of the error for the dev server, the build couldn't still go through. The console output follows:

> NODE_ENV=production webpack --config config/webpack.prod.js --progress --display-error-details

10% 0/1 build modulests-loader: Using typescript@1.8.2 and tsconfig.json
3260ms build modules      
7ms seal 
14ms optimize
10ms hashing
23ms create chunk assets
786ms additional chunk assets
470ms optimize chunk assets
662ms optimize assets
14ms emit
Hash: 8b07afa8903b37de50ac
Version: webpack 1.12.14
Time: 5310ms
Asset    Size  Chunks             Chunk Names
app.js  701 kB       0  [emitted]  main
app.js.map  834 kB       0  [emitted]  main
+ 177 hidden modules

ERROR in app.js from UglifyJs
Unexpected token: name (App) [./app/components/app.js:20,0]

The error reminds the one with the dev server.

JoseFMP commented 5 years ago

For me also happening