- Clone the repo and start your own:
git clone gist.github.com/74894d99417d3d0e876f267736e85c4f.git
rm -rf .git
git init
- Install dependencies:
npm install
{ | |
"name": "starter-template-es6", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"start": "webpack-dev-server --mode development --open --progress", | |
"build": "webpack --mode production" | |
}, | |
"keywords": [], | |
"author": "", | |
"license": "ISC", | |
"devDependencies": { | |
"babel-core": "^6.26.3", | |
"babel-loader": "^7.1.5", | |
"babel-preset-env": "^1.7.0", | |
"css-loader": "^2.1.1", | |
"file-loader": "^3.0.1", | |
"html-webpack-plugin": "^3.2.0", | |
"style-loader": "^0.23.1", | |
"url-loader": "^1.1.2", | |
"webpack": "^4.29.6", | |
"webpack-cli": "^3.3.0", | |
"webpack-dev-server": "^3.2.1" | |
} | |
} |
const HtmlWebPackPlugin = require("html-webpack-plugin"); | |
module.exports = { | |
entry: __dirname + "/src/index.js", // webpack entry point. Module to start building dependency graph | |
output: { | |
path: __dirname + '/dist', // Folder to store generated bundle | |
filename: 'bundle.js', // Name of generated bundle after build | |
publicPath: '/' // public URL of the output directory when referenced in a browser | |
}, | |
devtool: 'source-map', | |
resolve: { | |
extensions: ['.js', '.jsx'], | |
alias: { | |
'@': __dirname + '/src/', | |
} | |
}, | |
module: { | |
rules: [ | |
{ | |
test: /\.js$/, | |
exclude: /node_modules/, | |
use: { | |
loader: "babel-loader" | |
} | |
}, | |
{ | |
test: /\.css$/, | |
use: [ | |
{ | |
loader: "style-loader" | |
}, | |
{ | |
loader: "css-loader", | |
} | |
] | |
}, | |
{ | |
test: /\.(png|svg|jpg|gif)$/, | |
loader: 'url-loader', | |
options: { | |
name: './images/[name].[ext]', | |
limit: 10000 | |
}, | |
} | |
] | |
}, | |
plugins: [ | |
new HtmlWebPackPlugin({ | |
template: __dirname + "/src/index.html", | |
inject: 'body' | |
})], | |
devServer: { | |
port: process.env.PORT || 4000, | |
contentBase: './dist', | |
historyApiFallback: true | |
} | |
}; |