Last active
October 22, 2016 08:43
-
-
Save clonn/00af8377ee4da2b2e6a5a60265b570d9 to your computer and use it in GitHub Desktop.
webpack init config
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Document</title> | |
</head> | |
<body> | |
<h1>Hello Webpack</h1> | |
<script src="bundle.js"></script> | |
</body> | |
</html> |
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
{ | |
"name": "webpack-starter-todo", | |
"version": "1.0.0", | |
"description": "", | |
"main": "bundle.js", | |
"dependencies": { | |
"css-loader": "^0.25.0", | |
"jquery": "^3.1.1", | |
"style-loader": "^0.13.1", | |
"webpack": "^1.13.2", | |
"webpack-dev-server": "^1.16.2", | |
"webpack-livereload-plugin": "^0.9.0" | |
}, | |
"devDependencies": { | |
"babel-core": "^6.17.0", | |
"babel-loader": "^6.2.5", | |
"babel-preset-es2015": "^6.16.0", | |
"webpack": "^1.13.2" | |
}, | |
"scripts": { | |
"start": "webpack-dev-server --progress --colors", | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "", | |
"license": "ISC" | |
} |
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
var webpack = require("webpack"); | |
var LiveReloadPlugin = require('webpack-livereload-plugin'); | |
var liveReloadOption = { | |
appendScriptTag: true | |
}; | |
var config = module.exports = { | |
watch: true, | |
devtool: 'source-map', | |
entry: { | |
app: ["./entry.js"] | |
}, | |
output: { | |
path: __dirname, | |
filename: "bundle.js" | |
}, | |
module: { | |
loaders: [ | |
{ test: /\.css$/, loaders: ["style", "css"]}, | |
{ | |
test: /\.js$/, | |
exclude: /(node_modules|bower_components)/, | |
loader: 'babel', // 'babel-loader' is also a valid name to reference | |
query: { | |
presets: ['es2015'] | |
} | |
} | |
] | |
}, | |
devServer: { | |
hot: true | |
}, | |
plugins: [ | |
new webpack.NoErrorsPlugin(), | |
new webpack.HotModuleReplacementPlugin(), | |
new LiveReloadPlugin(liveReloadOption) | |
] | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment