This readme is based on this guide (no relation).
It's presumed that you have Yarn installed on your system. NPM will work too, but you'll need to switch the commands. This guide does not include versioning (like GitHub) setup which you should probably have as well.
- Run
yarn init
in your project directory. You can leave all fields blank. - Run
yarn add webpack webpack-dev-server babel-core babel-loader babel-preset-es2015 --save-dev
- Create
webpack.config.js
in the root of your project directory with the following code:
module.exports = {
entry: './app/main.js',
output: {
filename: 'bundle.js'
},
module: {
loaders: [
{
loader: 'babel-loader',
test: /\.js$/,
exclude: /node_modules/
}
]
},
devServer: {
port: 3000
},
devtool: 'inline-source-map'
};
- Create
index.html
inside the root of your project directory:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>My chat-bubble Project</title>
</head>
<body>
<script src="./bundle.js"></script>
</body>
</html>
- Run
yarn add chat-bubble
and create/app
direcotry withmain.js
that has the sample code from README.md.
Now you can run yarn webpack-dev-server
and open http://localhost:3000 in your browser to test your project!