Skip to content

Instantly share code, notes, and snippets.

@brentropy
Last active August 29, 2015 14:08
Show Gist options
  • Select an option

  • Save brentropy/2a2f72579cc0b2906ada to your computer and use it in GitHub Desktop.

Select an option

Save brentropy/2a2f72579cc0b2906ada to your computer and use it in GitHub Desktop.

Revisions

  1. brentropy revised this gist Nov 6, 2014. 1 changed file with 3 additions and 5 deletions.
    8 changes: 3 additions & 5 deletions webpack.config.js
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,6 @@
    var DefinePlugin = require('webpack').DefinePlugin
    var HtmlWebpackPlugin = require('html-webpack-plugin')

    var envPlugin = new DefinePlugin({
    ENV: JSON.stringify(process.env.BUILD_ENV || 'development')
    })

    module.exports = {
    entry: './main.js',
    output: {
    @@ -20,7 +16,9 @@ module.exports = {
    ]
    },
    plugins: [
    envPlugin,
    new DefinePlugin({
    ENV: JSON.stringify(process.env.BUILD_ENV || 'development')
    }),
    new HtmlWebpackPlugin({
    title: 'Page Title for HTML'
    })
  2. brentropy created this gist Nov 6, 2014.
    25 changes: 25 additions & 0 deletions package.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    {
    "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"
    }
    }
    31 changes: 31 additions & 0 deletions webpack.config.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,31 @@
    var DefinePlugin = require('webpack').DefinePlugin
    var HtmlWebpackPlugin = require('html-webpack-plugin')

    var envPlugin = new DefinePlugin({
    ENV: JSON.stringify(process.env.BUILD_ENV || 'development')
    })

    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: [
    envPlugin,
    new HtmlWebpackPlugin({
    title: 'Page Title for HTML'
    })
    ],
    resolve: {
    extensions: ['', '.js', '.json']
    }
    }