Last active
October 5, 2019 22:29
-
-
Save sizief/8d8057686eb003d7281615be14157826 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Development | |
- $ npm init -y | |
- $ npm install nodemon --save-dev | |
- $ npm install @babel/core @babel/cli @babel/node @babel/preset-env --save-dev | |
- `.babelrc` -> `{"presets": ["@babel/preset-env"]}` | |
- `package.json` -> `"scripts": {"build":"babel src -d dist"}` | |
- `package.json` -> `"scripts": {"start":"nodemon --exec babel-node src/file.js"}` | |
or following line is the same. But note that following line is NOT restart the the output based on code changes. | |
- `package.json` -> `"start": "npm run build && nodemon dist/todo_store.js"` | |
- $ npm start | |
Production for node (This will not bundle dependecies in one file, you will get `require not defined` error if run it on browser.) | |
- $ npm run build | |
- $ node dist/file.js | |
Production for browser | |
- $ browserify dist/compiled.js -o bundle.js | |
- insert into HTML `<script src="bundle.js"></script>` | |
For `Mobx` add this to `.babelrc`: | |
``` | |
{ | |
"presets": ["@babel/preset-env"], | |
"plugins": [ | |
["@babel/plugin-proposal-decorators", { "legacy": true }], | |
["@babel/plugin-proposal-class-properties", { "loose": true }] | |
] | |
} | |
``` | |
--- | |
Webpack | |
- npm install webpack --save-dev | |
- npm install webpack-cli --save-dev | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment