{
"name": "webpack",
"version": "1.0.0",
"description": "",
"main": "webpack.config.js",
"scripts": {
"start": "webpack"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"webpack": "^4.44.2",
"webpack-cli": "^3.3.12"
}
}
var path = require('path');
module.exports = {
mode: 'development',
entry: './src/index.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js'
}
};
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hello Webpack</title>
<script type="text/javascript" src="bundle.js"></script>
</head>
<body>
</body>
</html>
import sum from './math';
const total = sum(3,5);
document.write(total);
const sum = (a, b) => a + b;
export default sum;