I have found the following very interesting tutorial:
https://medium.com/@rossbulat/how-to-use-typescript-with-react-and-redux-a118b1e02b76
Here are some things that did not work at first.
1. Installing Create React App with Typescript
I had an older version of create-react-app, so it did not install typescript.
So i had to uninstall the global version and reinstall so that npx always takes the latest version:
npm uninstall -g create-react-app
npx create-react-app app_name --typescript
As described: https://facebook.github.io/create-react-app/docs/getting-started
2. Installing TSLint-React
I am using VSCode and when i run tslint --init i got this error:
tslint : The term 'tslint' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or
if a path was included, verify that the path is correct and try again.
I had to install like this:
npm install -g tslint typescript tslint-react
tslint --init
Showing posts with label React. Show all posts
Showing posts with label React. Show all posts
Friday, July 19, 2019
Monday, August 21, 2017
'git push heroku master' is still asking for authentication
Even if I executed heroku longin and entered username and password, I keep getting failed login error.
When asked for git heroku credentials enter the following:
username: <leave empty>
password: heroku auth token
Note: the heroku auth token can be retrieved using the following command:
heroku auth:token
Source: https://stackoverflow.com/questions/27810419/git-push-heroku-master-is-still-asking-for-authentication
When asked for git heroku credentials enter the following:
username: <leave empty>
password: heroku auth token
Note: the heroku auth token can be retrieved using the following command:
heroku auth:token
Source: https://stackoverflow.com/questions/27810419/git-push-heroku-master-is-still-asking-for-authentication
Friday, August 18, 2017
Error when running webpack
I had the following code:
webpack.config.js
package.json
When running webpack in command line I was getting this error
Version: webpack 1.12.13
Time: 1394ms
+ 1 hidden modules
ERROR in ./public/app.jsx
Module build failed: Error: Plugin 19 specified in "D:\\Projects\\HelloReact\\node_modules\\babel-preset-es2015\\index.js" provided an invalid property of "name"
at Plugin.init (D:\Projects\HelloReact\node_modules\babel-core\lib\transformation\plugin.js:127:13)
at Function.normalisePlugin (D:\Projects\HelloReact\node_modules\babel-core\lib\transformation\file\options\option-manager.js:176:12)
at D:\Projects\HelloReact\node_modules\babel-core\lib\transformation\file\options\option-manager.js:210:30
at Array.map (native)
at Function.normalisePlugins (D:\Projects\HelloReact\node_modules\babel-core\lib\transformation\file\options\option-manager.js:182:20)
at OptionManager.mergeOptions (D:\Projects\HelloReact\node_modules\babel-core\lib\transformation\file\options\option-manager.js:298:36)
at D:\Projects\HelloReact\node_modules\babel-core\lib\transformation\file\options\option-manager.js:370:14
at D:\Projects\HelloReact\node_modules\babel-core\lib\transformation\file\options\option-manager.js:390:24
at Array.map (native)
at OptionManager.resolvePresets (D:\Projects\HelloReact\node_modules\babel-core\lib\transformation\file\options\option-manager.js:385:20)
at OptionManager.mergePresets (D:\Projects\HelloReact\node_modules\babel-core\lib\transformation\file\options\option-manager.js:369:10)
at OptionManager.mergeOptions (D:\Projects\HelloReact\node_modules\babel-core\lib\transformation\file\options\option-manager.js:328:14)
at OptionManager.init (D:\Projects\HelloReact\node_modules\babel-core\lib\transformation\file\options\option-manager.js:481:10)
at File.initOptions (D:\Projects\HelloReact\node_modules\babel-core\lib\transformation\file\index.js:211:75)
at new File (D:\Projects\HelloReact\node_modules\babel-core\lib\transformation\file\index.js:129:22)
at Pipeline.transform (D:\Projects\HelloReact\node_modules\babel-core\lib\transformation\pipeline.js:48:16)
at transpile (D:\Projects\HelloReact\node_modules\babel-loader\index.js:14:22)
at Object.module.exports (D:\Projects\HelloReact\node_modules\babel-loader\index.js:88:12)
Solution(that worked for me): Upgrade babel-core and babel-loader
npm install --save babel-core@latest babel-loader@latest
Running webpack went smoothly after that.
Source: https://stackoverflow.com/questions/35395881/plugin-0-specified-in-babel-preset-es2015-provided-an-invalid-property-of-c
webpack.config.js
module.exports = {
entry: './public/app.jsx',
output: {
entry: './public/app.jsx',
output: {
path: __dirname,
filename: './public/bundle.js'
},
resolve: {
extensions: ['','.js','.jsx']
},
module: {
loaders: [
{
loader: 'babel-loader',
query: {
presets: ['react', 'es2015']
},
test: /\.jsx?$/,
exclude: /(node_modules|bower_components)/
}
]
}
};
package.json
{
"name": "hello-react",
"version": "1.0.0",
"description": "Simple react app",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Alina",
"license": "MIT",
"dependencies": {
"express": "^4.15.4",
"react": "^0.14.7",
"react-dom": "^0.14.7"
},
"devDependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.1",
"babel-preset-es2015": "^6.5.0",
"babel-preset-react": "^6.5.0",
"webpack": "^1.12.13"
}
}
When running webpack in command line I was getting this error
Version: webpack 1.12.13
Time: 1394ms
+ 1 hidden modules
ERROR in ./public/app.jsx
Module build failed: Error: Plugin 19 specified in "D:\\Projects\\HelloReact\\node_modules\\babel-preset-es2015\\index.js" provided an invalid property of "name"
at Plugin.init (D:\Projects\HelloReact\node_modules\babel-core\lib\transformation\plugin.js:127:13)
at Function.normalisePlugin (D:\Projects\HelloReact\node_modules\babel-core\lib\transformation\file\options\option-manager.js:176:12)
at D:\Projects\HelloReact\node_modules\babel-core\lib\transformation\file\options\option-manager.js:210:30
at Array.map (native)
at Function.normalisePlugins (D:\Projects\HelloReact\node_modules\babel-core\lib\transformation\file\options\option-manager.js:182:20)
at OptionManager.mergeOptions (D:\Projects\HelloReact\node_modules\babel-core\lib\transformation\file\options\option-manager.js:298:36)
at D:\Projects\HelloReact\node_modules\babel-core\lib\transformation\file\options\option-manager.js:370:14
at D:\Projects\HelloReact\node_modules\babel-core\lib\transformation\file\options\option-manager.js:390:24
at Array.map (native)
at OptionManager.resolvePresets (D:\Projects\HelloReact\node_modules\babel-core\lib\transformation\file\options\option-manager.js:385:20)
at OptionManager.mergePresets (D:\Projects\HelloReact\node_modules\babel-core\lib\transformation\file\options\option-manager.js:369:10)
at OptionManager.mergeOptions (D:\Projects\HelloReact\node_modules\babel-core\lib\transformation\file\options\option-manager.js:328:14)
at OptionManager.init (D:\Projects\HelloReact\node_modules\babel-core\lib\transformation\file\options\option-manager.js:481:10)
at File.initOptions (D:\Projects\HelloReact\node_modules\babel-core\lib\transformation\file\index.js:211:75)
at new File (D:\Projects\HelloReact\node_modules\babel-core\lib\transformation\file\index.js:129:22)
at Pipeline.transform (D:\Projects\HelloReact\node_modules\babel-core\lib\transformation\pipeline.js:48:16)
at transpile (D:\Projects\HelloReact\node_modules\babel-loader\index.js:14:22)
at Object.module.exports (D:\Projects\HelloReact\node_modules\babel-loader\index.js:88:12)
Solution(that worked for me): Upgrade babel-core and babel-loader
npm install --save babel-core@latest babel-loader@latest
Running webpack went smoothly after that.
Source: https://stackoverflow.com/questions/35395881/plugin-0-specified-in-babel-preset-es2015-provided-an-invalid-property-of-c
Subscribe to:
Posts (Atom)