Skip to content

Instantly share code, notes, and snippets.

@diem1
Created June 22, 2016 09:31
Show Gist options
  • Select an option

  • Save diem1/c752080db8ea2a1b59cc3822fbce9de1 to your computer and use it in GitHub Desktop.

Select an option

Save diem1/c752080db8ea2a1b59cc3822fbce9de1 to your computer and use it in GitHub Desktop.

Revisions

  1. diem1 created this gist Jun 22, 2016.
    2 changes: 2 additions & 0 deletions some_js_file.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,2 @@
    var domain = process.env.DOMAIN || null;
    console.log(domain);
    41 changes: 41 additions & 0 deletions webpack.config.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,41 @@
    var ExtractTextPlugin = require("extract-text-webpack-plugin"),
    webpack = require('webpack');

    module.exports = {
    node: {
    fs: "empty"
    },
    entry: './index',
    output: {
    path: __dirname,
    filename: 'bundle.js'
    },
    module: {
    loaders: [
    {
    test: /\.css$/,
    loader: ExtractTextPlugin.extract('style-loader', 'css-loader')
    },
    {
    test: /.js?$/,
    loader: 'babel-loader',
    exclude: /node_modules/,
    query: {
    presets: ['es2015', 'react']
    }
    }
    ]
    },
    plugins: [
    new ExtractTextPlugin('bundle.css'),
    new webpack.DefinePlugin({
    'process.env': {
    'DOMAIN': JSON.stringify(process.env.DOMAIN)
    }
    })
    ],
    devServer: {
    port: 8080,
    historyApiFallback: true
    }
    }