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

added JS #2

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"presets": [
"react",
"env",
"stage-1"
],
"plugins": [
"jsx-control-statements",
"transform-object-rest-spread"
]
}
17 changes: 16 additions & 1 deletion README.md
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
# Nikolai_Rubtsov
# Todo MVC example

## Init

Install Node.js (use [nvm](https://github.com/creationix/nvm))

```bash
npm i
```

## Run

```bash
npm run start
```

48 changes: 48 additions & 0 deletions babel-loader.webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import jsonfile from 'jsonfile';

const babelrc = jsonfile.readFileSync('.babelrc');

// список презетов, которые принудительно будут убраны из babel-config, ибо нам нужны свои параметры для `env`
const blacklistedPresets = [
'es2015',
'es2016',
'es2017',
'es2018',
'latest',
'env',
];

export default DEV_MODE => {

const presets = [
// Latest *stable* ECMAScript features
['env', {
modules: false,
loose: true,
}],
...babelrc.presets.filter(name => !blacklistedPresets.includes(name)),
];

const plugins = [
...babelrc.plugins,
...!DEV_MODE ? [] : [
// Adds component stack to warning messages
// https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-jsx-source
'transform-react-jsx-source',
// Adds __self attribute to JSX which React will use for some warnings
// https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-jsx-self
'transform-react-jsx-self',
],
];


return {
// https://github.com/babel/babel-loader#options
cacheDirectory: DEV_MODE,

// https://babeljs.io/docs/usage/options/
babelrc: false,
presets,
plugins,
}
}
8 changes: 8 additions & 0 deletions config/Env.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* @enum {Env}
*/
export const Env = {
DEVELOPMENT: 'development',
PRODUCTION: 'production',
TEST: 'test',
};
9 changes: 9 additions & 0 deletions config/projectConfig.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export default {
build: {
dist: './dist'
},

devLocal: {
devServerPort: 3002,
},
}
Loading