Last active
August 29, 2015 14:08
-
-
Save brentropy/2a2f72579cc0b2906ada to your computer and use it in GitHub Desktop.
Example webpack build
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-build-example", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"start": "webpack-dev-server -d", | |
"build": "webpack -p", | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "Brent Burgoyne", | |
"license": "MIT", | |
"devDependencies": { | |
"css-loader": "^0.9.0", | |
"file-loader": "^0.8.1", | |
"html-webpack-plugin": "^1.1.0", | |
"jsx-loader": "^0.12.0", | |
"less": "^1.7.5", | |
"less-loader": "^0.7.7", | |
"style-loader": "^0.8.1", | |
"url-loader": "^0.5.5", | |
"webpack": "^1.4.10", | |
"webpack-dev-server": "^1.6.5" | |
} | |
} |
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 DefinePlugin = require('webpack').DefinePlugin | |
var HtmlWebpackPlugin = require('html-webpack-plugin') | |
module.exports = { | |
entry: './main.js', | |
output: { | |
path: './build', | |
filename: 'main.[hash].js', | |
chunkFilename: 'chunk.[hash].[id].js' | |
}, | |
module: { | |
loaders: [ | |
{test: /\.js$/, loader: 'jsx-loader?harmony'}, | |
{test: /\.less$/, loader:'style-loader!css-loader!less-loader'}, | |
{test: /\.(png|jpg)$/, loader: 'url-loader?limit=8192'} | |
] | |
}, | |
plugins: [ | |
new DefinePlugin({ | |
ENV: JSON.stringify(process.env.BUILD_ENV || 'development') | |
}), | |
new HtmlWebpackPlugin({ | |
title: 'Page Title for HTML' | |
}) | |
], | |
resolve: { | |
extensions: ['', '.js', '.json'] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment