yarn init
- Use
yarn init -y
to skip all the questions and use defaults.
- Use
yarn add webpack webpack-cli webpack-dev-server --dev
- Webpack is the workhorse that bundles all the assets from source to output.
- Since version 4 of webpack webpack-cli is required.
- The dev server is not necessary but is the easiest way to serve and hot reload pages locally.
yarn add "babel-loader@^8.0.0-beta" @babel/core @babel/preset-env --dev
- Babel loader teaches webpack how to use babel to transform ES6 to ES5.
- Babel core does the transformations.
- Preset env tells it what transformations to perform.
- Add the webpack.config.js
- Update the package.json to include scripts
- Create index.html
- Create index.js
yarn run server
yarn add lit-html
yarn add lit-router
- https://github.com/FormidableLabs/webpack-dashboard
If I exclude
node_modules
from babel then it doesn't run on dependencies which can cause uglify to have an error if they use newer syntax. Removing theexclude
line fixes this.