Skip to content

Using ExtendedDefinePlugin#47

Open
arikmaor wants to merge 1 commit intopetehunt:masterfrom
arikmaor:master
Open

Using ExtendedDefinePlugin#47
arikmaor wants to merge 1 commit intopetehunt:masterfrom
arikmaor:master

Conversation

@arikmaor
Copy link

@arikmaor arikmaor commented Dec 9, 2015

This guide helped me a lot learning webpack basics
I wrote a wrapper for define plugin, I wish you to consider using it in your guide

it does the JSON.stringify() part for you so you can also include config files like this:

// app.config.js
module.exports = {
    dev: {
        api_key: '1234567890ABCDEFG'
        fb_conf: {
          use_social: true,
          api_key: '123456790'
        }
    },
    prod: {
        api_key: '1234567890ABCDEFG'
        fb_conf: {
          use_social: true,
          api_key: '123456790'
        }
    }
};
// webpack.config.js

var ExtendedDefinePlugin = require('extended-define-webpack-plugin');
var appConfig = require('./app.config.js');

module.exports = {
  // ...
  plugins: [
    /* ..., */
    new ExtendedDefinePlugin({
      APP_CONFIG: appConfig[process.env.NODE_ENV],
    })
  ]
};

@bebraw
Copy link

bebraw commented Aug 2, 2016

Did you see EnvironmentPlugin? It gets quite close.

@arikmaor
Copy link
Author

arikmaor commented Aug 2, 2016

It didn't exist when I wrote my plugin.
I agree it looks like they do the same job.

On Tuesday, August 2, 2016, Juho Vepsäläinen notifications@github.com
wrote:

Did you see EnvironmentPlugin
https://webpack.github.io/docs/list-of-plugins.html#environmentplugin?
It gets quite close.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#47 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AB1kY_Qyi1fihKPlpLlIfPqy6YBIkI-rks5qb3eQgaJpZM4GyTJg
.

Arik Maor
arikmaor@gmail.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants